Fix for case insensitive filesystem upates

This fix was made necessary when a library changed the case of one of its files, but kept the name the same.
When the file was updated in place, the case did not change.
The solution is to delete the file first before extracting the new one from the zip file with the changed case.
This commit is contained in:
JayZed 2024-05-27 21:18:45 -04:00 committed by GitHub
parent 0e183c428b
commit 884200441b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -165,6 +165,9 @@ def apply_update():
parent_dir = os.path.dirname(file_path) parent_dir = os.path.dirname(file_path)
os.makedirs(parent_dir, exist_ok=True) os.makedirs(parent_dir, exist_ok=True)
if not os.path.isdir(file_path): if not os.path.isdir(file_path):
if os.path.exists(file_path):
# remove the file first to handle case-insensitive file systems
os.remove(file_path)
with open(file_path, 'wb+') as f: with open(file_path, 'wb+') as f:
f.write(archive.read(file)) f.write(archive.read(file))
except Exception: except Exception: