mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Fix temporary project not cleanup with save as
This commit is contained in:
1 parent
0dea63c9ea
commit
d2d91ebdea
3 files changed
+19
-6
No files matched your search
@@ -139,9 +139,22 @@ class Project:
|
||||
if path != self._path and self.is_local() is False:
|
||||
raise aiohttp.web.HTTPForbidden(text="You are not allowed to modify the project directory location")
|
||||
|
||||
old_path = None
|
||||
if hasattr(self, "_path"):
|
||||
old_path = self._path
|
||||
|
||||
self._path = path
|
||||
self._update_temporary_file()
|
||||
|
||||
# The order of operation is important because we want to avoid losing
|
||||
# data
|
||||
if old_path:
|
||||
try:
|
||||
shutil.rmtree(old_path)
|
||||
except OSError as e:
|
||||
raise aiohttp.web.HTTPConflict("Can't remove temporary directory {}: {}".format(old_path ,e))
|
||||
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
||||
|
||||
Reference in new issue
Block a user