From a3133218932f9bc96a228de0d40951c5656e2b16 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Thu, 30 Jan 2014 14:23:04 -0200 Subject: [PATCH] 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. --- base/PCMain.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/base/PCMain.cpp b/base/PCMain.cpp index 732879c650..9f9e8cb86f 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -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());