| 52 | |
| 53 | |
| 54 | NATRON_NAMESPACE_ENTER |
| 55 | |
| 56 | static QStringList |
| 57 | getSplitPath(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 | |
| 96 | struct FileSystemModelPrivate |
| 97 | { |
nothing calls this directly
no test coverage detected