diff options
author | Micah Lee <micah@micahflee.com> | 2018-11-26 18:07:12 -0800 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2018-11-26 18:07:12 -0800 |
commit | 942f4f6bac805f332c4c51efeabe01cc539d0fd1 (patch) | |
tree | 82df871f2b7e8e2e3c70ebf431f28e714b537eff /onionshare/settings.py | |
parent | 01baf3d6fde55a83368a85ace8632079ceb61c25 (diff) | |
parent | 6bfe9d4476b894e7d0dbb54f4bb689637ead0ad0 (diff) | |
download | onionshare-942f4f6bac805f332c4c51efeabe01cc539d0fd1.tar.gz onionshare-942f4f6bac805f332c4c51efeabe01cc539d0fd1.zip |
Merge branch 'develop' into 406_osx_sandbox
Diffstat (limited to 'onionshare/settings.py')
-rw-r--r-- | onionshare/settings.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/onionshare/settings.py b/onionshare/settings.py index ca3fccfa..3397c1fd 100644 --- a/onionshare/settings.py +++ b/onionshare/settings.py @@ -127,14 +127,18 @@ class Settings(object): """ Returns the path of the default Downloads directory for receive mode. """ - # TODO: Test in Windows, though it looks like it should work - # https://docs.python.org/3/library/os.path.html#os.path.expanduser + if self.common.platform == "Darwin": - # We can't use os.path.expanduser in macOS because in the sandbox it + # We can't use os.path.expanduser() in macOS because in the sandbox it # returns the path to the sandboxed homedir real_homedir = pwd.getpwuid(os.getuid()).pw_dir return os.path.join(real_homedir, 'OnionShare') + elif self.common.platform == "Windows": + # On Windows, os.path.expanduser() needs to use backslash, or else it + # retains the forward slash, which breaks opening the folder in explorer. + return os.path.expanduser('~\OnionShare') else: + # All other OSes return os.path.expanduser('~/OnionShare') def load(self): |