diff --git a/onionshare/settings.py b/onionshare/settings.py index adcfc7a3..073798e5 100644 --- a/onionshare/settings.py +++ b/onionshare/settings.py @@ -105,9 +105,13 @@ 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 - return os.path.expanduser('~/OnionShare') + # On Windows, os.path.expanduser() needs to use backslash, or else it + # retains the forward slash, which breaks opening the folder in explorer. + p = platform.system() + if p == 'Windows': + return os.path.expanduser('~\OnionShare') + else: + return os.path.expanduser('~/OnionShare') def load(self): """ diff --git a/onionshare_gui/receive_mode/uploads.py b/onionshare_gui/receive_mode/uploads.py index bf502f99..8d95d984 100644 --- a/onionshare_gui/receive_mode/uploads.py +++ b/onionshare_gui/receive_mode/uploads.py @@ -96,7 +96,7 @@ class File(QtWidgets.QWidget): # Windows elif self.common.platform == 'Windows': - subprocess.Popen(['explorer', '/select', abs_filename]) + subprocess.Popen(['explorer', '/select,{}'.format(abs_filename)]) class Upload(QtWidgets.QWidget):