mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-13 08:19:28 -05:00
Use os.path.expanduser when creating data dir, and no need to try creating data dir in Settings.save because it's created in Config.build_data_dir
This commit is contained in:
parent
415c01e00a
commit
5d7449c476
@ -134,11 +134,11 @@ class Common(object):
|
||||
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 = '~/.config/onionshare'
|
||||
onionshare_data_dir = os.path.expanduser('~/.config/onionshare')
|
||||
elif self.platform == 'Darwin':
|
||||
onionshare_data_dir = '~/Library/Application Support/OnionShare'
|
||||
onionshare_data_dir = os.path.expanduser('~/Library/Application Support/OnionShare')
|
||||
else:
|
||||
onionshare_data_dir = '~/.config/onionshare'
|
||||
onionshare_data_dir = os.path.expanduser('~/.config/onionshare')
|
||||
|
||||
os.makedirs(onionshare_data_dir, 0o700, True)
|
||||
return onionshare_data_dir
|
||||
|
@ -185,7 +185,6 @@ class Settings(object):
|
||||
Save settings to file.
|
||||
"""
|
||||
self.common.log('Settings', 'save')
|
||||
os.makedirs(os.path.dirname(self.filename), exist_ok=True)
|
||||
open(self.filename, 'w').write(json.dumps(self._settings))
|
||||
self.common.log('Settings', 'save', 'Settings saved in {}'.format(self.filename))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user