MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / deleteFile

Method deleteFile

src/Mod/Material/App/MaterialLibrary.cpp:243–261  ·  view source on GitHub ↗

This accepts the filesystem path as returned from getLocalPath

Source from the content-addressed store, hash-verified

241
242// This accepts the filesystem path as returned from getLocalPath
243void 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
263void MaterialLibraryLocal::updatePaths(const QString& oldPath, const QString& newPath)
264{

Callers 10

~RedirectionMethod · 0.45
SaveDocFileMethod · 0.45
RestoreDocFileMethod · 0.45
SaveDocFileMethod · 0.45
RestoreDocFileMethod · 0.45
saveToFileMethod · 0.45
loadFromFileMethod · 0.45
loadOutputMethod · 0.45
~ZipFixerMethod · 0.45
loadOutputMethod · 0.45

Calls 6

DeleteErrorClass · 0.85
removeFunction · 0.50
removeMethod · 0.45
getUUIDMethod · 0.45
logMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected