diff options
author | Micah Lee <micah@micahflee.com> | 2019-11-03 00:47:51 -0700 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2019-11-03 00:47:55 -0700 |
commit | 1787adabc741d4ce75131fca833b560ee7aa485e (patch) | |
tree | 1f44b0c9d6d7160b37cfa53b371a426588684390 /onionshare | |
parent | 70f8e4384d6125b6a5c3f4b85722be93ca62acbb (diff) | |
download | onionshare-1787adabc741d4ce75131fca833b560ee7aa485e.tar.gz onionshare-1787adabc741d4ce75131fca833b560ee7aa485e.zip |
Start writing tabs tests
Diffstat (limited to 'onionshare')
-rw-r--r-- | onionshare/common.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/onionshare/common.py b/onionshare/common.py index 5245ddf9..cf713818 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -159,20 +159,23 @@ class Common: """ Returns the path of the OnionShare data directory. """ - if self.platform == "Windows": - try: - appdata = os.environ["APPDATA"] - onionshare_data_dir = f"{appdata}\\OnionShare" - 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") - elif self.platform == "Darwin": - onionshare_data_dir = os.path.expanduser( - "~/Library/Application Support/OnionShare" - ) + if getattr(sys, "onionshare_test_mode", False): + onionshare_data_dir = os.path.expanduser("~/.config/onionshare-testdata") else: - onionshare_data_dir = os.path.expanduser("~/.config/onionshare") + if self.platform == "Windows": + try: + appdata = os.environ["APPDATA"] + onionshare_data_dir = f"{appdata}\\OnionShare" + 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") + elif self.platform == "Darwin": + onionshare_data_dir = os.path.expanduser( + "~/Library/Application Support/OnionShare" + ) + else: + onionshare_data_dir = os.path.expanduser("~/.config/onionshare") os.makedirs(onionshare_data_dir, 0o700, True) return onionshare_data_dir |