Skip to content

Commit

Permalink
🐛 修复未将模板资源打包的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
KomoriDev authored Jan 16, 2025
1 parent 2d7c3cf commit a362b89
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions generate_data_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
data_path = Path(__file__).parent / "data"
font_path = Path(__file__).parent / "font"
img_path = Path(__file__).parent / "image"
template_path = Path(__file__).parent / "templates"

file_list = [{
'path': f"{file.parent.name}/{file.name}",
'hash': hashlib.md5(file.read_bytes()).hexdigest(),
'lock': True
} for file in font_path.iterdir()]


this_path = str(Path().absolute())

for file in data_path.rglob("*"):
Expand All @@ -26,7 +26,6 @@
'lock': True
})


for file in img_path.rglob("*"):
if not file.is_file():
continue
Expand All @@ -37,12 +36,19 @@
'lock': True
})

for file in template_path.rglob("*"):
if not file.is_file():
continue

file_list.append({
'path': str(file.relative_to(this_path)).replace("\\", "/"),
'hash': hashlib.md5(file.read_bytes()).hexdigest(),
'lock': True
})

with open('abscension_data_list.json', 'w', encoding='utf-8') as f:
json.dump(file_list, f, ensure_ascii=False, indent=2)



resources_zip_path = Path() / 'resources.zip'
resources_zip = zipfile.ZipFile(resources_zip_path, 'w', zipfile.ZIP_DEFLATED)

Expand All @@ -52,5 +58,7 @@
resources_zip.write(file)
for file in Path('image').rglob('*'):
resources_zip.write(file)
for file in Path('templates').rglob('*'):
resources_zip.write(file)

resources_zip.close()

0 comments on commit a362b89

Please sign in to comment.