Skip to content

Commit

Permalink
Merge pull request #18 from spaceskynet/main
Browse files Browse the repository at this point in the history
移动资源包到global_packs/required_resources下使其能自动加载
  • Loading branch information
spaceskynet authored Feb 28, 2023
2 parents 9a2cd43 + 7202d01 commit e809678
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions make_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def add_objs(files, zip_fp, base_dir = '.'):
resourcepack_path = os.path.join(src_dir, 'resourcepacks', resourcepack_name)

# Required directories
required_dirs = ['resourcepacks', 'config', 'kubejs', 'global_packs']
required_dirs = ['config', 'kubejs', 'global_packs', 'global_packs/required_resources']

# Make Dirs
if not os.path.isdir(release_dir): os.makedirs(release_dir)
Expand All @@ -57,7 +57,7 @@ def add_objs(files, zip_fp, base_dir = '.'):
# Resourcepack
os.chdir(resourcepack_path)
jsons = glob.glob("assets/*/lang/zh_cn.json")
resourcepack_zip = os.path.join(release_dir, 'resourcepacks', f'{resourcepack_name}.zip')
resourcepack_zip = os.path.join(release_dir, 'global_packs/required_resources', f'{resourcepack_name}.zip')
with zipfile.ZipFile(resourcepack_zip, 'w', zipfile.ZIP_DEFLATED) as zip_fp:
for json in jsons:
zip_fp.write(json)
Expand All @@ -70,6 +70,7 @@ def add_objs(files, zip_fp, base_dir = '.'):
release_zip = os.path.join(release_dir, f'{release_name}.zip')
with zipfile.ZipFile(release_zip, 'w', zipfile.ZIP_DEFLATED) as zip_fp:
for required_dir in required_dirs:
if '/' in required_dir: continue
add_dir_to_zipfile(required_dir, zip_fp)
for md_file in md_files:
md_path = os.path.join(work_dir, md_file)
Expand All @@ -78,6 +79,6 @@ def add_objs(files, zip_fp, base_dir = '.'):
# Delete Temp Files
for required_dir in required_dirs:
required_path = os.path.join(release_dir, required_dir)
shutil.rmtree(required_path)
# shutil.rmtree(required_path)

print('[INFO] All is done!')

0 comments on commit e809678

Please sign in to comment.