Cleanup the temporary project after modules have been notified of the

path change
This commit is contained in:
Julien Duponchelle committed 2015-05-26 15:20:14 +02:00
1 parent 528bb7a7c6
commit c98bcedd39
4 files changed
+40 -12

No files matched your search

+8 -4
View File
@@ -146,11 +146,15 @@ class Project:
self._path = path
self._update_temporary_file()
# The order of operation is important because we want to avoid losing
# data
if old_path:
@asyncio.coroutine
def clean_old_path(self, old_path):
"""
Called after a project location change. All the modules should
have been notified before
"""
if self._temporary:
try:
shutil.rmtree(old_path)
yield from wait_run_in_executor(shutil.rmtree, old_path)
except OSError as e:
log.warn("Can't remove temporary directory {}: {}".format(old_path, e))