Skip to content

Commit

Permalink
Add cross-platform support for opening directories
Browse files Browse the repository at this point in the history
- Added platform checks for Windows, Linux, and Mac
- Updated opendir function to handle platform-specific directory opening
- Replaced Popen with os.system
  • Loading branch information
Lenochxd committed Dec 16, 2024
1 parent fb01876 commit 9490014
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/buttons/system/opendir.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from subprocess import Popen
from app.utils.platform import is_windows, is_linux, is_mac
from app.utils.logger import log


Expand All @@ -12,6 +12,12 @@ def normalize_path(path):

path = os.path.abspath(path)
log.debug(f"Opening directory: {path}")
Popen(f'explorer "{path}"')

if is_windows:
os.system(f'explorer "{path}"')
elif is_linux:
os.system(f'xdg-open "{path}"')
elif is_mac:
os.system(f'open "{path}"')

return path

0 comments on commit 9490014

Please sign in to comment.