mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 03:14:34 +01:00
Add Launch{Browser,Market,Email} support on Linux
Modern Linux desktop should implement a xdg-open program, that should open an URL on the default desktop program. The documentation of xdg-open says that we should supply xdg-open script on our installation script for fallback purposes, but I don't think this is really necessary: anyone using a reasonable recently DE on Linux should have xdg-utils installed.
This commit is contained in:
1 parent
398137422c
commit
a8fbcb6165
1 file changed
+10
@@ -11,6 +11,7 @@
|
||||
#else
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
@@ -228,6 +229,9 @@ void LaunchBrowser(const char *url)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif __linux__
|
||||
std::string command = std::string("xdg-open ") + url;
|
||||
system(command.c_str());
|
||||
#else
|
||||
ILOG("Would have gone to %s but LaunchBrowser is not implemented on this platform", url);
|
||||
#endif
|
||||
@@ -237,6 +241,9 @@ void LaunchMarket(const char *url)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif __linux__
|
||||
std::string command = std::string("xdg-open ") + url;
|
||||
system(command.c_str());
|
||||
#else
|
||||
ILOG("Would have gone to %s but LaunchMarket is not implemented on this platform", url);
|
||||
#endif
|
||||
@@ -246,6 +253,9 @@ void LaunchEmail(const char *email_address)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
ShellExecute(NULL, "open", (std::string("mailto:") + email_address).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif __linux__
|
||||
std::string command = std::string("xdg-open mailto:") + email_address;
|
||||
system(command.c_str());
|
||||
#else
|
||||
ILOG("Would have opened your email client for %s but LaunchEmail is not implemented on this platform", email_address);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user