core: Don't attempt to write to the inside of an OSX App Bundle (#4380)

* core: Frozen OSX should also use Home Directory

* Use Application Support instead of homedir

* Suggested changes
This commit is contained in:
Katelyn Gigante
2025-06-20 02:05:52 +10:00
committed by GitHub
parent 4eefd9c3ce
commit c2666bacd7

View File

@@ -166,6 +166,10 @@ def home_path(*path: str) -> str:
os.symlink(home_path.cached_path, legacy_home_path)
else:
os.makedirs(home_path.cached_path, 0o700, exist_ok=True)
elif sys.platform == 'darwin':
import platformdirs
home_path.cached_path = platformdirs.user_data_dir("Archipelago", False)
os.makedirs(home_path.cached_path, 0o700, exist_ok=True)
else:
# not implemented
home_path.cached_path = local_path() # this will generate the same exceptions we got previously
@@ -177,7 +181,7 @@ def user_path(*path: str) -> str:
"""Returns either local_path or home_path based on write permissions."""
if hasattr(user_path, "cached_path"):
pass
elif os.access(local_path(), os.W_OK):
elif os.access(local_path(), os.W_OK) and not (is_macos and is_frozen()):
user_path.cached_path = local_path()
else:
user_path.cached_path = home_path()