Skip to content

Commit 8ea6da5

Browse files
author
arch
committed
improve install lua scripts
1 parent 63cc5f4 commit 8ea6da5

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

.github/workflows/prerelease_windows_application.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,15 @@ jobs:
5656
run: |
5757
cp "contrib/Installer/assets/main.lua" "dist/funscript-editor/OFS/main.lua"
5858
59+
- name: Create json lua extensions dir
60+
shell: bash -l {0}
61+
run: |
62+
mkdir -p "dist/funscript-editor/OFS/json"
63+
5964
- name: Add json Lua Extension
6065
shell: bash -l {0}
6166
run: |
62-
cp "contrib/Installer/assets/json.lua" "dist/funscript-editor/OFS/json.lua"
67+
cp "contrib/Installer/assets/json.lua" "dist/funscript-editor/OFS/json/lua.lua"
6368
6469
- name: Create Asset Archive
6570
uses: vimtor/action-zip@v1

.github/workflows/release_windows_application.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,15 @@ jobs:
6161
run: |
6262
cp "contrib/Installer/assets/main.lua" "dist/funscript-editor/OFS/main.lua"
6363
64+
- name: Create json lua extensions dir
65+
shell: bash -l {0}
66+
run: |
67+
mkdir -p "dist/funscript-editor/OFS/json"
68+
6469
- name: Add json Lua Extension
6570
shell: bash -l {0}
6671
run: |
67-
cp "contrib/Installer/assets/json.lua" "dist/funscript-editor/OFS/json.lua"
72+
cp "contrib/Installer/assets/json.lua" "dist/funscript-editor/OFS/json/lua.lua"
6873
6974
- name: Add Version to Build
7075
shell: bash -l {0}

contrib/Installer/mtfg-ofs-extension-installer.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ def process_exists(process_name):
8787
return False
8888

8989

90-
def install_lua_scripts(src_dir, extension_dir):
91-
for script in ["main.lua", "json.lua"]:
92-
if os.path.exists(os.path.join(src_dir, "OFS", script)):
93-
shutil.copy2(os.path.join(src_dir, "OFS", script), os.path.join(extension_dir, script))
94-
else:
95-
error("Installation failed (" + script + " missing)")
90+
def install_lua_scripts(root_src_dir, extension_dir):
91+
for src_dir, _, files in os.walk(root_src_dir):
92+
dst_dir = src_dir.replace(root_src_dir, extension_dir, 1)
93+
if not os.path.exists(dst_dir):
94+
os.makedirs(dst_dir)
95+
for file_ in files:
96+
src_file = os.path.join(src_dir, file_)
97+
dst_file = os.path.join(dst_dir, file_)
98+
if os.path.exists(dst_file):
99+
os.remove(dst_file)
100+
shutil.copy(src_file, dst_dir)
96101

97102

98103
def is_latest_version_installed(version_file, version):

0 commit comments

Comments
 (0)