Add fallback in case of xdg-utils is not installed

Some distributions may not install xdg-utils by default,
so inform the user in case of xdg-utils is not installed
when the user tries to use any of the xdg-utils commands.
This commit is contained in:
Thiago Kenji Okada committed 2014-01-30 14:23:04 -02:00
1 parent b0e318f6d1
commit a313321893
1 file changed
+10 -1
+10 -1
View File
@@ -217,7 +217,10 @@ void LaunchBrowser(const char *url) {
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
#elif __linux__
std::string command = std::string("xdg-open ") + url;
system(command.c_str());
errno = system(command.c_str());
if (errno) {
ILOG("Would have gone to %s but xdg-utils seems not to be installed", url)
}
#elif __APPLE__
std::string command = std::string("open ") + url;
system(command.c_str());
@@ -232,6 +235,9 @@ void LaunchMarket(const char *url) {
#elif __linux__
std::string command = std::string("xdg-open ") + url;
system(command.c_str());
if (errno) {
ILOG("Would have gone to %s but xdg-utils seems not to be installed", url)
}
#elif __APPLE__
std::string command = std::string("open ") + url;
system(command.c_str());
@@ -246,6 +252,9 @@ void LaunchEmail(const char *email_address) {
#elif __linux__
std::string command = std::string("xdg-email ") + email_address;
system(command.c_str());
if (errno) {
ILOG("Would have gone to %s but xdg-utils seems not to be installed", email_address)
}
#elif __APPLE__
std::string command = std::string("open mailto:") + email_address;
system(command.c_str());