z411 / trackma

Open multi-site list manager for Unix-like systems. (ex-wMAL)
https://z411.github.io/trackma
GNU General Public License v3.0
775 stars 81 forks source link

Unification of 'open-folder' function, should fix 'xdg-open' path error #727

Open BigBoyBarney opened 8 months ago

BigBoyBarney commented 8 months ago

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

BigBoyBarney commented 7 months ago

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