[SDL] SDL 1.3 roadmap...
Sami Näätänen
sn.ml at bayminer.com
Tue Oct 9 06:47:39 PDT 2007
On Tuesday 09 October 2007, Gabriele Greco wrote:
> Andre Krause wrote:
> > i know - this is exactly the problem with linux. isnt it a shame?
> > but maybe someone here on the list can take the burden and find a
> > method that work for the most common linux distro's ? and on
> > systems, where no reliable method is known, open_url could return
> > false if it was not able to open the url. so the application could
> > present at least the
>
> Yes, while mac and win32 have simple, documented, ways to do so on
> linux it's more tricky:
>
> void
> openurl(const char *url)
> {
> #ifdef WIN32
> ShellExecute(GetActiveWindow(),
> "open", url, NULL, NULL, SW_SHOWNORMAL);
> #elif defined(__APPLE__)
> char buffer[256];
> snprintf(buffer, sizeof(buffer), "open %s", url);
> system(buffer);
> #else
> char *apps[] = {"x-www-browser",
> "firefox", // iceweasel has an alias on debian
> "opera",
> "mozilla",
> "galeon",
> "konqueror", NULL};
>
> char buffer[256];
> int i = 0;
>
> while (apps[i]) {
> snprintf(buffer, sizeof(buffer), "which %s >/dev/null",
> apps[i]); if (system(buffer) == 0) {
> snprintf(buffer, sizeof(buffer), "%s %s", apps[i], url);
> system(buffer);
> return;
> }
> i++;
> }
> #endif
>
> }
In Linux case I would first check if there is any of the listed browsers
running and would use that as the browser. If not then fallback to run
the first one present in the list.
More information about the SDL
mailing list