feat: add fallback for python library search, etc.

This commit is contained in:
Horror Proton
2023-03-05 19:24:44 +08:00
parent b308417dd7
commit cd63bbdda4
2 changed files with 9 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import ctypes
import ctypes.util
import json
import os
import pathlib
@@ -65,7 +66,13 @@ class Asst:
os.environ[platform_values[platform_type]['environ_var']] += os.pathsep + str(path)
except KeyError:
os.environ[platform_values[platform_type]['environ_var']] = os.pathsep + str(path)
Asst.__lib = lib_import_func(str(Asst.__libpath))
try:
Asst.__lib = lib_import_func(str(Asst.__libpath))
except OSError:
Asst.__libpath = ctypes.util.find_library('MaaCore')
Asst.__lib = lib_import_func(str(Asst.__libpath))
Asst.__set_lib_properties()
ret: bool = True

View File

@@ -19,7 +19,7 @@ def my_callback(msg, details, arg):
if __name__ == "__main__":
# 请设置为存放 dll 文件及资源的路径
path = pathlib.Path.cwd().parent
path = pathlib.Path(__file__).parent.parent
# 设置更新器的路径和目标版本并更新
Updater(path, Version.Stable).update()