| 181 | } |
| 182 | |
| 183 | QString Library::getRelativePath(const QString& path) const |
| 184 | { |
| 185 | QString filePath; |
| 186 | QString clean = QDir::cleanPath(path); |
| 187 | QString prefix = QStringLiteral("/") + getName(); |
| 188 | if (clean.startsWith(prefix)) { |
| 189 | // Remove the library name from the path |
| 190 | filePath = clean.right(clean.length() - prefix.length()); |
| 191 | } |
| 192 | else { |
| 193 | filePath = clean; |
| 194 | } |
| 195 | |
| 196 | prefix = getDirectoryPath(); |
| 197 | if (filePath.startsWith(prefix, caseSensitivity())) { |
| 198 | // Remove the library root from the path |
| 199 | filePath = filePath.right(filePath.length() - prefix.length()); |
| 200 | } |
| 201 | |
| 202 | // Remove any leading '/' |
| 203 | if (filePath.startsWith(QStringLiteral("/"))) { |
| 204 | filePath.remove(0, 1); |
| 205 | } |
| 206 | |
| 207 | return filePath; |
| 208 | } |
| 209 | |
| 210 | QString Library::getLibraryPath(const QString& path, const QString& filename) const |
| 211 | { |
nothing calls this directly
no test coverage detected