If directory already exists, delete before extraction to ensure no errors
This commit is contained in:
parent
53f39cf97e
commit
890c67c5ff
3
main.py
3
main.py
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue