From efeb3b8d2408f1e8f1b088758732d55ff89f692f Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 25 Sep 2023 14:12:20 +0200 Subject: [PATCH] A few more win32 compat fixes Signed-off-by: falkTX --- html/js/modgui.js | 2 +- modtools/utils.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/html/js/modgui.js b/html/js/modgui.js index 3c659dd5..25a8feac 100644 --- a/html/js/modgui.js +++ b/html/js/modgui.js @@ -2660,7 +2660,7 @@ JqueryClass('customSelectPath', baseWidget, { if (!self.data('enabled')) { return self.customSelectPath('prevent', e) } - var value = opt.attr('mod-parameter-value').replace('\\','\\\\') + var value = opt.attr('mod-parameter-value').replace(/\\/g,'\\\\') self.customSelectPath('setValue', value, false) }) }) diff --git a/modtools/utils.py b/modtools/utils.py index d9871129..a6d53734 100644 --- a/modtools/utils.py +++ b/modtools/utils.py @@ -5,6 +5,7 @@ import os from ctypes import * from mod import get_unique_name +from sys import platform # ------------------------------------------------------------------------------------------------------------ # Convert a ctypes c_char_p into a python string @@ -144,13 +145,21 @@ def unionToDict(struct): # ------------------------------------------------------------------------------------------------------------ -tryPath1 = os.path.join(os.path.dirname(__file__), "libmod_utils.so") -tryPath2 = os.path.join(os.path.dirname(__file__), "..", "utils", "libmod_utils.so") +if platform == 'win32': + ext = "dll" +else: + ext = "so" + +tryPath1 = os.path.join(os.path.dirname(__file__), "libmod_utils." + ext) +tryPath2 = os.path.join(os.path.dirname(__file__), "..", "lib", "libmod_utils." + ext) +tryPath3 = os.path.join(os.path.dirname(__file__), "..", "utils", "libmod_utils." + ext) if os.path.exists(tryPath1): utils = cdll.LoadLibrary(tryPath1) -else: +elif os.path.exists(tryPath2): utils = cdll.LoadLibrary(tryPath2) +else: + utils = cdll.LoadLibrary(tryPath3) # PluginLicenseType kPluginLicenseNonCommercial = 0