Merge pull request #256 from zanllp/fix-open-folder
Fix issue with opening local file browser on macOSpull/264/head
commit
551ccc24b6
|
|
@ -6,6 +6,7 @@ import tempfile
|
||||||
import imghdr
|
import imghdr
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
import sys
|
||||||
import piexif
|
import piexif
|
||||||
import piexif.helper
|
import piexif.helper
|
||||||
|
|
||||||
|
|
@ -337,14 +338,14 @@ def open_folder(folder_path, file_path=None):
|
||||||
file = os.path.join(folder, file_path)
|
file = os.path.join(folder, file_path)
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
subprocess.run(['explorer', '/select,', file])
|
subprocess.run(['explorer', '/select,', file])
|
||||||
|
elif sys.platform == 'darwin':
|
||||||
|
subprocess.run(['open', '-R', file])
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
subprocess.run(['xdg-open', file])
|
subprocess.run(['xdg-open', file])
|
||||||
elif os.name == 'mac':
|
|
||||||
subprocess.run(['open', '-R', file])
|
|
||||||
else:
|
else:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
subprocess.run(['explorer', folder])
|
subprocess.run(['explorer', folder])
|
||||||
|
elif sys.platform == 'darwin':
|
||||||
|
subprocess.run(['open', folder])
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
subprocess.run(['xdg-open', folder])
|
subprocess.run(['xdg-open', folder])
|
||||||
elif os.name == 'mac':
|
|
||||||
subprocess.run(['open', folder])
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue