Initial commit of WQ_GUI
This commit is contained in:
25
scripts/rthook_add_dll_dirs.py
Normal file
25
scripts/rthook_add_dll_dirs.py
Normal file
@ -0,0 +1,25 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def _safe_add(path: str) -> None:
|
||||
if not path or not os.path.isdir(path):
|
||||
return
|
||||
try:
|
||||
if hasattr(os, "add_dll_directory"):
|
||||
os.add_dll_directory(path)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
os.environ["PATH"] = path + os.pathsep + os.environ.get("PATH", "")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# PyInstaller onefile 解包目录
|
||||
base = getattr(sys, "_MEIPASS", None)
|
||||
if base:
|
||||
_safe_add(base)
|
||||
_safe_add(os.path.join(base, "lib-dynload"))
|
||||
_safe_add(os.path.join(base, "DLLs"))
|
||||
|
||||
Reference in New Issue
Block a user