mirror of
https://github.com/NinjaCheetah/NUSGet.git
synced 2025-06-07 11:01:02 -04:00
Updated config to use Application Support on macOS
NUSGet will now also create .config if it doesn't exist on Linux, though I really can't see that ever happening.
This commit is contained in:
parent
27680626fa
commit
dd189f31b1
@ -4,15 +4,20 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
def get_config_file() -> pathlib.Path:
|
def get_config_file() -> pathlib.Path:
|
||||||
config_dir = pathlib.Path(os.path.join(
|
if platform.system() == "Windows":
|
||||||
os.environ.get('APPDATA') or
|
config_dir = pathlib.Path(os.environ.get('APPDATA'), "NUSGet")
|
||||||
os.environ.get('XDG_CONFIG_HOME') or
|
elif platform.system() == "Darwin":
|
||||||
os.path.join(os.environ['HOME'], '.config'),
|
config_dir = pathlib.Path(os.environ['HOME'], "Library", "Application Support", "NUSGet")
|
||||||
"NUSGet"
|
else:
|
||||||
))
|
if os.environ.get('XDG_CONFIG_HOME'):
|
||||||
config_dir.mkdir(exist_ok=True)
|
config_dir = pathlib.Path(os.environ.get('XDG_CONFIG_HOME'), "NUSGet")
|
||||||
|
else:
|
||||||
|
config_dir = pathlib.Path(os.environ['HOME'], ".config", "NUSGet")
|
||||||
|
config_dir.mkdir(exist_ok=True, parents=True)
|
||||||
return config_dir.joinpath("config.json")
|
return config_dir.joinpath("config.json")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user