diff options
Diffstat (limited to 'onionshare/common.py')
-rw-r--r-- | onionshare/common.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/onionshare/common.py b/onionshare/common.py index ffa6529f..6b3d85c4 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -123,6 +123,23 @@ class Common(object): return (tor_path, tor_geo_ip_file_path, tor_geo_ipv6_file_path, obfs4proxy_file_path) + def build_data_dir(self): + """ + Returns the path of the OnionShare data directory. + """ + if self.platform == 'Windows': + try: + appdata = os.environ['APPDATA'] + return '{}\\OnionShare'.format(appdata) + except: + # If for some reason we don't have the 'APPDATA' environment variable + # (like running tests in Linux while pretending to be in Windows) + return os.path.expanduser('~/.config/onionshare') + elif self.platform == 'Darwin': + return os.path.expanduser('~/Library/Application Support/OnionShare') + else: + return os.path.expanduser('~/.config/onionshare') + def build_slug(self): """ Returns a random string made from two words from the wordlist, such as "deter-trig". |