mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Merge pull request #763 from mig5/open_folder_uploads_macos_windows
Open folder containing uploads with the file selected, in macOS and Windows
This commit is contained in:
commit
6bfe9d4476
@ -138,9 +138,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):
|
||||
"""
|
||||
|
@ -184,16 +184,11 @@ class UploadHistoryItemFile(QtWidgets.QWidget):
|
||||
|
||||
# macOS
|
||||
elif self.common.platform == 'Darwin':
|
||||
# TODO: Implement opening folder with file selected in macOS
|
||||
# This seems helpful: https://stackoverflow.com/questions/3520493/python-show-in-finder
|
||||
self.common.log('UploadHistoryItemFile', 'open_folder', 'not implemented for Darwin yet')
|
||||
subprocess.call(['open', '-R', abs_filename])
|
||||
|
||||
# Windows
|
||||
elif self.common.platform == 'Windows':
|
||||
# TODO: Implement opening folder with file selected in Windows
|
||||
# This seems helpful: https://stackoverflow.com/questions/6631299/python-opening-a-folder-in-explorer-nautilus-mac-thingie
|
||||
self.common.log('UploadHistoryItemFile', 'open_folder', 'not implemented for Windows yet')
|
||||
|
||||
subprocess.Popen(['explorer', '/select,{}'.format(abs_filename)])
|
||||
|
||||
class UploadHistoryItem(HistoryItem):
|
||||
def __init__(self, common, id, content_length):
|
||||
|
Loading…
Reference in New Issue
Block a user