If directory already exists, delete before extraction to ensure no errors

This commit is contained in:
Wizzard 2024-01-23 15:04:30 -05:00
parent 53f39cf97e
commit 890c67c5ff
1 changed files with 3 additions and 0 deletions

View File

@ -49,6 +49,9 @@ def is_new_version_available(local_version_path, server_version_url):
return False return False
def unzip_file(zip_path, extract_to_path): def unzip_file(zip_path, extract_to_path):
if extract_to_path.exists():
shutil.rmtree(extract_to_path)
extract_to_path.mkdir(parents=True, exist_ok=True)
with zipfile.ZipFile(zip_path, 'r') as zip_ref: with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(extract_to_path) zip_ref.extractall(extract_to_path)