This accepts the filesystem path as returned from getLocalPath
| 241 | |
| 242 | // This accepts the filesystem path as returned from getLocalPath |
| 243 | void MaterialLibraryLocal::deleteFile(MaterialManager& manager, const QString& path) |
| 244 | { |
| 245 | if (QFile::remove(path)) { |
| 246 | // Remove from the map |
| 247 | QString rPath = getRelativePath(path); |
| 248 | try { |
| 249 | auto material = getMaterialByPath(rPath); |
| 250 | manager.remove(material->getUUID()); |
| 251 | } |
| 252 | catch (const MaterialNotFound&) { |
| 253 | Base::Console().log("Unable to remove file from materials list\n"); |
| 254 | } |
| 255 | _materialPathMap->erase(rPath); |
| 256 | } |
| 257 | else { |
| 258 | QString error = QStringLiteral("DeleteError: Unable to delete ") + path; |
| 259 | throw DeleteError(error); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | void MaterialLibraryLocal::updatePaths(const QString& oldPath, const QString& newPath) |
| 264 | { |
no test coverage detected