From d3f51cf7c095740af3dd6ff3eeec97c363625311 Mon Sep 17 00:00:00 2001 From: Pecon Date: Tue, 11 Aug 2020 12:51:46 -0700 Subject: [PATCH] Basic Platform::openWebBrowser implementation for linux --- .../platformX86UNIX/x86UNIXPlatform.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Engine/source/platformX86UNIX/x86UNIXPlatform.cpp b/Engine/source/platformX86UNIX/x86UNIXPlatform.cpp index 0f10d1eb4..2e6011c49 100644 --- a/Engine/source/platformX86UNIX/x86UNIXPlatform.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXPlatform.cpp @@ -1,8 +1,26 @@ #include "platform/platform.h" +#include bool Platform::openWebBrowser( const char* webAddress ) { - return false; // TODO LINUX + std::string startingURL(webAddress); + std::string filteredURL; + + unsigned short length = startingURL.length(); + for(unsigned short i = 0; i < length; i++) + { + filteredURL = filteredURL + '\\' + startingURL.at(i); + } + + std::string runCommand = "URL=" + filteredURL + "; xdg-open $URL > /dev/null 2> /dev/null"; + + short statusCode; + statusCode = system(runCommand.c_str()); + + if(statusCode == 0) + return true; + + return false; } #ifdef TORQUE_DEDICATED