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

Function QStringList getSplitPath

Engine/FileSystemModel.cpp:54–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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