mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00
Core: Use the location of Utils.py rather than __main__ to determine the AP Folder (#4009)
This commit is contained in:
5
Utils.py
5
Utils.py
@@ -139,8 +139,11 @@ def local_path(*path: str) -> str:
|
||||
local_path.cached_path = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
else:
|
||||
import __main__
|
||||
if hasattr(__main__, "__file__") and os.path.isfile(__main__.__file__):
|
||||
if globals().get("__file__") and os.path.isfile(__file__):
|
||||
# we are running in a normal Python environment
|
||||
local_path.cached_path = os.path.dirname(os.path.abspath(__file__))
|
||||
elif hasattr(__main__, "__file__") and os.path.isfile(__main__.__file__):
|
||||
# we are running in a normal Python environment, but AP was imported weirdly
|
||||
local_path.cached_path = os.path.dirname(os.path.abspath(__main__.__file__))
|
||||
else:
|
||||
# pray
|
||||
|
Reference in New Issue
Block a user