From 8b0cb16b9e6268fd050a624517b260a3b15d86a6 Mon Sep 17 00:00:00 2001 From: monkeyman192 Date: Mon, 4 Nov 2024 22:44:18 +1100 Subject: [PATCH] gh-19: Fix some issues with relative paths --- pymhf/main.py | 1 + pymhf/utils/config.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pymhf/main.py b/pymhf/main.py index 5bd19e6..6f99309 100644 --- a/pymhf/main.py +++ b/pymhf/main.py @@ -273,6 +273,7 @@ def kill_injected_code(loop: asyncio.AbstractEventLoop): _preinject_shellcode = f.read() pm_binary.inject_python_shellcode(_preinject_shellcode) # Inject the common NMS variables which are required for general use. + module_path = op.realpath(module_path) module_path = module_path.replace("\\", "\\\\") pm_binary.inject_python_shellcode( f""" diff --git a/pymhf/utils/config.py b/pymhf/utils/config.py index ef9cae3..8165976 100644 --- a/pymhf/utils/config.py +++ b/pymhf/utils/config.py @@ -58,14 +58,13 @@ def canonicalize_setting( print("Critical Error: Cannot find user directory. Ensure APPDATA environment variable is set") exit() if plugin_name is not None: - return op.join(appdata_data, "pymhf", plugin_name, *_suffix) + return op.realpath(op.join(appdata_data, "pymhf", plugin_name, *_suffix)) else: raise ValueError("{USER_DIR} cannot be used for single-file mods.") elif tag == "EXE_DIR": if exe_dir: - return op.join(exe_dir, *_suffix) + return op.realpath(op.join(exe_dir, *_suffix)) else: raise ValueError("Exe directory cannot be determined") elif tag == "CURR_DIR": - print(module_dir, _suffix) - return op.join(module_dir, *_suffix) + return op.realpath(op.join(module_dir, *_suffix))