Protect against crashes when the temporary file is still in use by

another process.

Contributes to CURA-5516.
This commit is contained in:
Diego Prado Gesto 2018-06-28 16:09:00 +02:00
parent c25a733768
commit 6737dfac47

View file

@ -330,7 +330,10 @@ class CuraPackageManager(QObject):
self.__installPackageFiles(package_id, src_dir_path, dst_dir_path)
# Remove the file
os.remove(filename)
try:
os.remove(filename)
except Exception:
Logger.log("w", "Tried to delete file [%s], but it failed", filename)
# Move the info to the installed list of packages only when it succeeds
self._installed_package_dict[package_id] = self._to_install_package_dict[package_id]