Make browse-url aware of xdg-open
clojure.java.browse/browse-url tests to see if it's running on Mac OS to fall back to "/usr/bin/open" in order
to open a URI. On most other systems it'll just falls through to open-url-in-swing instead. The attached patch
tests to see if freedesktop.org's "xdg-open" is present in the users path. This way browse-url will launch the
program associated with the URI, in my case chromium.
All platforms that provide xdg-open (as part of freedesktop.org) benefit from this. Fix was tested on OpenBSD.
Comment made by: jasperla
And I've tested it on OpenBSD.
Screened. Verified on Mac OS X.
clj-896-browse-url-uses-xdg-open-patch2.txt is based more on the patch attached to by Jeremy Heiler than on the earlier patch attached to this ticket. He and I have signed CAs.
I think this patch improves on both of the previous patches for and CLJ-920. In particular, Jeremy's worked fine, but it caused a long slowdown in the running of tests when building Clojure. This one does not.
Mac OS X 10.6.8
Windows XP SP3, both in cmd.exe and a Cygwin bash shell
Ubuntu 10.04 LTS
It would be great if someone could test it on a BSD system. The only possible issue I can think of is whether the output of the "which" command is different there than on the Linux system I tested.
If someone wants to make a patch that doesn't use "which", but instead checks the PATH, I'd recommend they also test on Windows in cmd.exe to make sure it works correctly there.
CLJ-920, if not identical, at least bears a significant resemblance to this ticket. It would be good to see if the patch for one of them fixes both issues.