mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-11 15:29:38 -05:00
Merge pull request #1336 from mig5/1293_support_xdg_config_home_env_var
Use XDG_CONFIG_HOME environment variable if it is present, otherwise fall back to ~/.config
This commit is contained in:
commit
66918946ae
@ -133,13 +133,21 @@ class Common:
|
|||||||
except:
|
except:
|
||||||
# If for some reason we don't have the 'APPDATA' environment variable
|
# If for some reason we don't have the 'APPDATA' environment variable
|
||||||
# (like running tests in Linux while pretending to be in Windows)
|
# (like running tests in Linux while pretending to be in Windows)
|
||||||
onionshare_data_dir = os.path.expanduser("~/.config/onionshare")
|
try:
|
||||||
|
xdg_config_home = os.environ["XDG_CONFIG_HOME"]
|
||||||
|
onionshare_data_dir = f"{xdg_config_home}/onionshare"
|
||||||
|
except:
|
||||||
|
onionshare_data_dir = os.path.expanduser("~/.config/onionshare")
|
||||||
elif self.platform == "Darwin":
|
elif self.platform == "Darwin":
|
||||||
onionshare_data_dir = os.path.expanduser(
|
onionshare_data_dir = os.path.expanduser(
|
||||||
"~/Library/Application Support/OnionShare"
|
"~/Library/Application Support/OnionShare"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
onionshare_data_dir = os.path.expanduser("~/.config/onionshare")
|
try:
|
||||||
|
xdg_config_home = os.environ["XDG_CONFIG_HOME"]
|
||||||
|
onionshare_data_dir = f"{xdg_config_home}/onionshare"
|
||||||
|
except:
|
||||||
|
onionshare_data_dir = os.path.expanduser("~/.config/onionshare")
|
||||||
|
|
||||||
# Modify the data dir if running tests
|
# Modify the data dir if running tests
|
||||||
if getattr(sys, "onionshare_test_mode", False):
|
if getattr(sys, "onionshare_test_mode", False):
|
||||||
|
Loading…
Reference in New Issue
Block a user