Merge pull request #256 from zanllp/fix-open-folder

Fix issue with opening local file browser on macOS
pull/264/head
zanllp 2023-06-21 02:03:35 +08:00 committed by GitHub
commit 551ccc24b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import tempfile
import imghdr
import subprocess
from typing import Dict
import sys
import piexif
import piexif.helper
@ -337,14 +338,14 @@ def open_folder(folder_path, file_path=None):
file = os.path.join(folder, file_path)
if os.name == 'nt':
subprocess.run(['explorer', '/select,', file])
elif sys.platform == 'darwin':
subprocess.run(['open', '-R', file])
elif os.name == 'posix':
subprocess.run(['xdg-open', file])
elif os.name == 'mac':
subprocess.run(['open', '-R', file])
else:
if os.name == 'nt':
subprocess.run(['explorer', folder])
elif sys.platform == 'darwin':
subprocess.run(['open', folder])
elif os.name == 'posix':
subprocess.run(['xdg-open', folder])
elif os.name == 'mac':
subprocess.run(['open', folder])