0

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?

Newbyte
  • 2,421
  • 5
  • 22
  • 45
  • how many browsers do you have installed on you MacOS? I know default Mac comes with the Safari,but you can install Firefox, Chrome, Opera etc on top. Now default application means that the OS will choose the application based on the file extension (pdf, doc{x}, txt, etc). In your case those functions will do the same thing. – Igor Aug 13 '23 at 14:33
  • @Igor As mentioned in the question, I am only opening a directory. On my system both of them open the default file manager and never a browser, but I don't know if it's like that on all operating systems. – Newbyte Aug 13 '23 at 14:56
  • I think it is. How did you test Windows/Linux before? – Igor Aug 13 '23 at 17:30
  • @Igor Someone else tested Windows. – Newbyte Aug 13 '23 at 18:37

1 Answers1

1

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.

VZ.
  • 21,740
  • 3
  • 39
  • 42