[SCM] Development fot GoFind! branch, master, updated. 0683ce4e393a3f387fbff1aee5588b4eca9faff0

Miriam Ruiz miriam at miriam.princast.es
Mon Nov 24 18:14:19 UTC 2008


The following commit has been merged in the master branch:
commit 0683ce4e393a3f387fbff1aee5588b4eca9faff0
Author: Miriam Ruiz <miriam at miriam.princast.es>
Date:   Mon Nov 24 19:18:55 2008 +0100

    Use /usr/bin/xdg-open if available, if not fall back to /usr/bin/sensible-browser

diff --git a/fltk/aux.cpp b/fltk/aux.cpp
index ef9cdd2..a7beb1a 100644
--- a/fltk/aux.cpp
+++ b/fltk/aux.cpp
@@ -29,6 +29,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <iostream>
 #include <string>
 
 #include <FL/Fl.H>
@@ -48,8 +49,15 @@ bool HTMLView::ExternalBrowser(const std::string &uri)
 	if (pid) /* A positive (non-negative) PID indicates the parent process */
 		return true;
 
+	std::string prg("/usr/bin/xdg-open");
+
+	struct stat stat_buffer;
+	if (stat(prg.c_str(), &stat_buffer)!=0 || stat_buffer.st_size == 0)
+		prg = std::string("/usr/bin/sensible-browser");
+
+std::cout << prg << std::endl;
 	/* A zero PID indicates that this is the child process */
-	std::string command = std::string("/usr/bin/sensible-browser \"") + uri +"\"";
+	std::string command = prg + std::string(" \"") + uri +"\"";
 	if (execl("/bin/sh", "sh", "-c", command.c_str(), (char *) 0) == -1)
 		ERROR_PRINTF("exec: %s\n", strerror(errno));
 

-- 
Development fot GoFind!



More information about the Pkg-games-commits mailing list