diff options
author | Kevin Gallagher <kevingallagher@gmail.com> | 2018-12-19 16:04:31 -0800 |
---|---|---|
committer | Kevin Gallagher <kevingallagher@gmail.com> | 2018-12-19 16:07:16 -0800 |
commit | 64cc9427e5948d2b88783c8e53c94ed9505107e9 (patch) | |
tree | 67c4527fffab3dcf73d57242fb7b180af4960be8 | |
parent | 3241d56ecc1dfa339ea07bf844eb6a8d5f3d5fba (diff) | |
download | onionshare-64cc9427e5948d2b88783c8e53c94ed9505107e9.tar.gz onionshare-64cc9427e5948d2b88783c8e53c94ed9505107e9.zip |
Make sure the OnionShare data directory is created
Fixes #850
-rw-r--r-- | onionshare/common.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/onionshare/common.py b/onionshare/common.py index c84046f0..d0fe79db 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -130,15 +130,18 @@ class Common(object): if self.platform == 'Windows': try: appdata = os.environ['APPDATA'] - return '{}\\OnionShare'.format(appdata) + onionshare_data_dir = '{}\\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') + onionshare_data_dir = '~/.config/onionshare' elif self.platform == 'Darwin': - return os.path.expanduser('~/Library/Application Support/OnionShare') + onionshare_data_dir = '~/Library/Application Support/OnionShare' else: - return os.path.expanduser('~/.config/onionshare') + onionshare_data_dir = '~/.config/onionshare' + + os.makedirs(onionshare_data_dir, 0o700, True) + return onionshare_data_dir def build_slug(self): """ |