|
8 | 8 | from collections.abc import Iterator |
9 | 9 | from functools import cache |
10 | 10 | from io import BytesIO |
| 11 | +from os import path |
11 | 12 | from pathlib import Path |
12 | 13 | from zipfile import ZIP_DEFLATED, ZipFile |
13 | 14 |
|
|
21 | 22 | ZIP_SETTINGS_FOLDER = ZIP_MODS_FOLDER / "settings" |
22 | 23 | ZIP_EXECUTABLE_FOLDER = Path("Binaries") |
23 | 24 | ZIP_PLUGINS_FOLDER = ZIP_EXECUTABLE_FOLDER / "Plugins" |
24 | | -ZIP_PROXY_INIT_SCRIPT_FOLDERS = [ |
25 | | - ZIP_EXECUTABLE_FOLDER / ZIP_MODS_FOLDER, |
26 | | -] |
27 | 25 |
|
28 | 26 | # The base CMake directories - these need the preset added after |
29 | 27 | BUILD_DIR_BASE = THIS_FOLDER / "out" / "build" |
|
40 | 38 |
|
41 | 39 | # And there are a few extra files which we want which aren't matched by the above |
42 | 40 | INIT_SCRIPT = MODS_FOLDER / "__main__.py" |
43 | | -PROXY_INIT_SCRIPT = MODS_FOLDER / "proxy__main__.py" |
44 | 41 | SETTINGS_GITIGNORE = MODS_FOLDER / "settings" / ".gitignore" |
45 | 42 | STUBS_DIR = THIS_FOLDER / "libs" / "pyunrealsdk" / "stubs" |
46 | 43 | STUBS_LICENSE = THIS_FOLDER / "libs" / "pyunrealsdk" / "LICENSE" |
@@ -222,17 +219,10 @@ def zip_config_file(zip_file: ZipFile) -> None: |
222 | 219 | Args: |
223 | 220 | zip_file: The zip file to add the config file to. |
224 | 221 | """ |
225 | | - # When launching via Steam, the CWD is (sometimes) `<steam>\Borderlands`. When launching via Mod |
226 | | - # Organiser, or by running the exe directly, it's `Borderlands\Binaries`. |
227 | | - # Stick with Steam as the default, since if we're not using Steam, the path this checks will |
228 | | - # still be inside the game folder. |
229 | | - init_script_path = str(ZIP_MODS_FOLDER / INIT_SCRIPT.name) |
230 | | - pyexec_root = str(ZIP_MODS_FOLDER) |
231 | | - |
232 | | - # Copy the proxy script to all the spots the relative path might otherwise end up |
233 | | - for path in ZIP_PROXY_INIT_SCRIPT_FOLDERS: |
234 | | - zip_file.write(PROXY_INIT_SCRIPT, path / INIT_SCRIPT.name) |
235 | | - zip_file.writestr(str(path / "Wrong folder, you cannot place sdk mods here!.txt"), "") |
| 222 | + # Path.relative_to doesn't work when where's no common base, need to use os.path |
| 223 | + # These paths are relative to the plugins folder |
| 224 | + init_script_path = path.relpath(ZIP_MODS_FOLDER / INIT_SCRIPT.name, ZIP_PLUGINS_FOLDER) |
| 225 | + pyexec_root = path.relpath(ZIP_MODS_FOLDER, ZIP_PLUGINS_FOLDER) |
236 | 226 |
|
237 | 227 | version_number = tomllib.loads(MANAGER_PYPROJECT.read_text())["project"]["version"] |
238 | 228 | git_version = get_git_repo_version() |
|
0 commit comments