Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
ci: 更新動態 FPS 的覆蓋 (#360)
Browse files Browse the repository at this point in the history
v2.4.0 已包含繁體翻譯 (1.20)
但 1.19 以下沒有,所以將此翻譯移動至 1.19 特定
  • Loading branch information
xMikux authored Sep 2, 2023
1 parent b3184fb commit cfdc52c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/configs/override_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@
},
{
"modName": "Dynamic FPS",
"modLoader": "Forge",
"modVersion": "main",
"modLoader": "Fabric",
"modVersion": "1.19",
"licenseURL": "https://raw.githubusercontent.com/juliand665/Dynamic-FPS/main/LICENSE",
"url": "https://raw.githubusercontent.com/juliand665/Dynamic-FPS/main/src/main/resources/assets/dynamicfps/lang/zh_tw.json"
"url": "https://raw.githubusercontent.com/juliand665/Dynamic-FPS/2.4.0/src/main/resources/assets/dynamicfps/lang/zh_tw.json"
},
{
"modName": "CoFHCore",
Expand Down
19 changes: 18 additions & 1 deletion .github/scripts/override_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def zip_copyer(temp_dir, modloader, version):
except OSError as e:
print(f"Error occurred while copying file: {e}")

# TODO Make this better
def zip_copyer_all(temp_dir, modloader, version):
source_path = os.path.join(temp_dir, "assets")
dest_path = Path("MultiVersions", modloader, version)
Expand All @@ -178,6 +179,19 @@ def zip_copyer_all(temp_dir, modloader, version):
except OSError as e:
print(f"Error occurred while copying file: {e}")

def zip_copyer_all_temp(temp_dir):
source_path = os.path.join(temp_dir, "MultiVersions")
dest_path = Path("MultiVersions")

print("> 模組 ID 複製全部(暫時)")
print("> 原始路徑", source_path)
print("> 目的路徑", dest_path)

try:
shutil.copytree(source_path, dest_path, dirs_exist_ok=True)
except OSError as e:
print(f"Error occurred while copying file: {e}")

def zip_extract(modname, modloader, version, url, extractAll: bool):
temp_dir = tempfile.mkdtemp()
override_file = os.path.join(temp_dir, os.path.basename(url))
Expand All @@ -190,7 +204,10 @@ def zip_extract(modname, modloader, version, url, extractAll: bool):
zip.extractall(temp_dir)

if extractAll:
zip_copyer_all(temp_dir, modloader, version)
if os.path.exists(os.path.join(temp_dir, "MultiVersions")):
zip_copyer_all_temp(temp_dir)
else:
zip_copyer_all(temp_dir, modloader, version)
else:
zip_copyer(temp_dir, modloader, version)

Expand Down

0 comments on commit cfdc52c

Please sign in to comment.