Add cleanup to avoid having files both in package and main folder

This commit is contained in:
CMDR-Kiel42 2019-08-06 10:55:28 +02:00
parent 5dd123d6e7
commit 758eeb2d22

View File

@ -38,6 +38,9 @@ class SpanshUpdater():
def install(self):
if self.zip_downloaded:
try:
# Cleaning up older versions
if os.path.exists(os.path.join(self.plugin_dir, "AutoCompleter.py")):
os.remove(os.path.join(self.plugin_dir, "*.py"))
with zipfile.ZipFile(self.zip_path, 'r') as zip_ref:
zip_ref.extractall(self.plugin_dir)
@ -45,4 +48,4 @@ class SpanshUpdater():
except NameError:
exc_type, exc_value, exc_traceback = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
sys.stderr.write(''.join('!! ' + line for line in lines))
sys.stderr.write(''.join('!! ' + line for line in lines))