trackma
trackma copied to clipboard
Unification of 'open-folder' function, should fix 'xdg-open' path error
Should fix #726 as long as xdg-open
is in $PATH
, which can be assumed for every distro. I tested it for GTK, Qt and CLI on Fedora 39.
[!CAUTION] As my other PR (#722), this requires python 3.10. Do not merge before #722 or without updating python dep.
Changes
Code
- Unified all 'open folder' functions in
utils.py
. Can take anerror_callback
param so error reporting can still be done uniquely for every UI. - Fixed OSError not being raised when the folder was in the library, but was changed after scanning. I.e:
- Start trackma
- 'Show X' gets scanned and found
- Rename folder of 'show X'
- Open folder
- Error is raised correctly
Thanks for the changes.
Which part of this PR requires Python 3.10? I'm not seeing it …
match sys.platform:
case 'darwin':
command = ["open", os.path.dirname(filename)]
case 'win32':
command = ["explorer", os.path.dirname(filename)]
case _:
command = ["xdg-open", os.path.dirname(filename)]
Match was introduced in Python 3.10