I'm writing a wxWidgets program wherein I need to open a local directory in the default file manager. This program should be cross-platform and work well on at least Windows and Linux, but preferably also macOS. I looked into ways to open a local directory without hard-coding any particular file manager or using platform-specific code, and found that wxWidgets provides two methods for this: wxLaunchDefaultApplication
and wxLaunchDefaultBrowser
. On my setup, they seem to do the same thing when I provide a local path that points to a directory as the first parameter, but I'm not able to test other platforms.
Are there any reasons to prefer one of these over the other for a cross-platform program where it will be used to open a local directory in the default file manager?
You should definitely use wxLaunchDefaultApplication()
for opening a local directory, the other function is for opening a (usually remote) URL in the browser and I'd expect it to use the actual browser at least on some systems.