MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / QStringList getSplitPath

Function QStringList getSplitPath

Engine/FileSystemModel.cpp:59–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57#endif
58
59NATRON_NAMESPACE_ENTER
60
61static QStringList
62getSplitPath(const QString& path)
63{
64 if ( path.isEmpty() ) {
65 return QStringList();
66 }
67 QString pathCpy = path;
68 bool isdriveOrRoot;
69#ifdef __NATRON_WIN32__
70 QString startPath = pathCpy.mid(0, 3);
71 isdriveOrRoot = FileSystemModel::isDriveName(startPath);
72 if (isdriveOrRoot) {
73 pathCpy = pathCpy.remove(0, 3);
74 }
75 if ( (pathCpy.size() > 0) && ( pathCpy[pathCpy.size() - 1] == QChar::fromLatin1('/') ) ) {
76 pathCpy = pathCpy.mid(0, pathCpy.size() - 1);
77 }
78 QStringList splitPath = pathCpy.split( QChar::fromLatin1('/') );
79 if (isdriveOrRoot) {
80 splitPath.prepend( startPath.mid(0, 3) );
81 }
82
83#else
84 isdriveOrRoot = pathCpy.startsWith( QChar::fromLatin1('/') );
85 if (isdriveOrRoot) {
86 pathCpy = pathCpy.remove(0, 1);
87 }
88 if ( (pathCpy.size() > 0) && ( pathCpy[pathCpy.size() - 1] == QChar::fromLatin1('/') ) ) {
89 pathCpy = pathCpy.mid(0, pathCpy.size() - 1);
90 }
91 QStringList splitPath = pathCpy.split( QChar::fromLatin1('/') );
92 if (isdriveOrRoot) {
93 splitPath.prepend( QChar::fromLatin1('/') );
94 }
95
96#endif
97
98 return splitPath;
99}
100
101struct FileSystemModelPrivate
102{

Callers

nothing calls this directly

Calls 4

QStringListClass · 0.85
removeMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected