mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-24 22:40:36 -04:00
Build downloads_dir a different way in macOS, so it's correct despite the sandbox
This commit is contained in:
parent
507cb837ab
commit
794573ec5e
1 changed files with 8 additions and 1 deletions
|
@ -22,6 +22,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import locale
|
import locale
|
||||||
|
import pwd
|
||||||
|
|
||||||
from . import strings
|
from . import strings
|
||||||
|
|
||||||
|
@ -128,6 +129,12 @@ class Settings(object):
|
||||||
"""
|
"""
|
||||||
# TODO: Test in Windows, though it looks like it should work
|
# TODO: Test in Windows, though it looks like it should work
|
||||||
# https://docs.python.org/3/library/os.path.html#os.path.expanduser
|
# 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
|
||||||
|
# returns the path to the sandboxed homedir
|
||||||
|
real_homedir = pwd.getpwuid(os.getuid()).pw_dir
|
||||||
|
return os.path.join(real_homedir, 'OnionShare')
|
||||||
|
else:
|
||||||
return os.path.expanduser('~/OnionShare')
|
return os.path.expanduser('~/OnionShare')
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue