-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
159 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# pip install pyunpack patool | ||
|
||
import sys | ||
import os | ||
import patoolib | ||
|
||
def is_multi_part_zip(file_path): | ||
z01_file = file_path[:-4] + ".z01" # Replace the last .zip with .z01 | ||
return os.path.exists(z01_file) | ||
|
||
def delete_original_files(file_path): | ||
base_name = file_path[:-4] | ||
files_to_delete = [file_path] + [base_name + ext for ext in ['.zip', '.z01', '.z02', '.z03', '.z04', '.z05', '.z06', '.z07', '.z08', '.z09']] | ||
for file in files_to_delete: | ||
if os.path.exists(file): | ||
os.remove(file) | ||
print(f"Deleted: {file}") | ||
|
||
def unzip_files(directory): | ||
for root, dirs, files in os.walk(directory): | ||
for file in files: | ||
file_path = os.path.join(root, file) | ||
if (file.endswith('.jar.zip') or file.endswith('.zip.zip')) and is_multi_part_zip(file_path): | ||
print(f"Processing file: {file_path}") | ||
try: | ||
patoolib.extract_archive(file_path, outdir=root) | ||
print(f"Unzipped: {file_path}") | ||
# Delete original files after successful extraction | ||
delete_original_files(file_path) | ||
except Exception as e: | ||
print(f"Error unzipping {file_path}: {e}") | ||
|
||
def main(): | ||
if len(sys.argv) != 2: | ||
print("Usage: ClientPkgReformat.py <DIRECTORY>") | ||
sys.exit(1) | ||
|
||
directory = sys.argv[1] | ||
|
||
if not os.path.isdir(directory): | ||
print(f"Error: {directory} is not a valid directory.") | ||
sys.exit(1) | ||
|
||
unzip_files(directory) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 玩家指南 For Players | ||
|
||
如果要使用此 Modpack,你不应该解压此文件夹。请直接在支持 Curseforge Modpack 的启动器中导入此 Modpack。 | ||
|
||
If you want to use this Modpack, you should not extract this folder. Please import this Modpack directly in the launcher that supports Curseforge Modpack. | ||
|
||
# For GitHub Users | ||
|
||
这是 Curseforge 的 Modpack 目录。最低要求只有 `manifest.json`。其他文件,如 `overrides` 文件夹,也可以包含在内。 | ||
|
||
This is the modpack dir for Curseforge. Minimal requirements are only `manifest.json`. Other files like `overrides` folder may be included. | ||
|
||
如果客户端没有特殊需要,可以关闭客户端打包的 Action Workflow 并删除此文件夹。 | ||
|
||
If the client has no special needs, you can disable the client packaging Action Workflow and delete this folder. | ||
|
File renamed without changes.
File renamed without changes.