I'm trying to find a way to launch a browser from a program, and it should work cross-platform, but unfortunately I haven't got a Mac to test it on.
In Linux, what I do is this:
- try to execute the command "which which". If this works, I know I've got the "which" command available, and I can use it to test for browsers.
- If I've got which, I try a list of browsers in turn using which, so I call "which firefox", "which konqueror", "which safari" and so on (the list is longer than that). If I find one that gives success from the which command, I call that with a url, so for example "firefox http://mub.org" or whatever.
So how would this work on a Mac? I know that Mac OSX is pretty much unix underneath the Applyness, so there must be a /usr/bin directory. But from what I've read, when an application is installed it doesn't really get installed as such but just put in /Applications or something. So there's no shortcut in /usr/bin for that application (depending on how it was installed of course). So what I'm trying to figure out is:
- Will the command "which which" work? (I'm guessing yes if which is available everywhere then it must find itself)
- Will the command "which firefox" work (or safari or whatever)? (I'm guessing that depends on where which can search for executables)
- Will the command "firefox http://mub.org" work? Will it be able to find the firefox executable from any directory or does it need the whole explicit path?
I'm guessing that the effect of running those commands from a console at ~ would be the same as running them from another program. Anyone with a Mac feel like trying them out for me please???
