summaryrefslogtreecommitdiff
path: root/cli/onionshare_cli/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/onionshare_cli/common.py')
-rw-r--r--cli/onionshare_cli/common.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/cli/onionshare_cli/common.py b/cli/onionshare_cli/common.py
index e812aa98..072babd1 100644
--- a/cli/onionshare_cli/common.py
+++ b/cli/onionshare_cli/common.py
@@ -133,13 +133,21 @@ class Common:
except:
# If for some reason we don't have the 'APPDATA' environment variable
# (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":
onionshare_data_dir = os.path.expanduser(
"~/Library/Application Support/OnionShare"
)
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
if getattr(sys, "onionshare_test_mode", False):