Skip to content

Commit e5da009

Browse files
committed
xrGame: Use xdg-open to open url links on Linux
1 parent e04dd5f commit e5da009

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/xrGame/MainMenu.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727
#include "ui/UICDkey.h"
2828

29+
#ifdef WINDOWS
2930
#include <shellapi.h>
3031
#pragma comment(lib, "shell32.lib")
32+
#endif
3133

3234
#include "Common/object_broker.h"
3335

@@ -848,9 +850,14 @@ void CMainMenu::OnDownloadMPMap_CopyURL(CUIWindow* w, void* d)
848850
void CMainMenu::OnDownloadMPMap(CUIWindow* w, void* d)
849851
{
850852
LPCSTR url = m_downloaded_mp_map_url.c_str();
853+
#ifdef WINDOWS
851854
LPCSTR params = NULL;
852855
STRCONCAT(params, "/C start ", url);
853856
ShellExecute(0, "open", "cmd.exe", params, NULL, SW_SHOW);
857+
#else
858+
std::string command = "xdg-open " + std::string{url};
859+
system(command.c_str());
860+
#endif
854861
}
855862

856863
demo_info const* CMainMenu::GetDemoInfo(LPCSTR file_name)

src/xrGame/login_manager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,14 @@ bool login_manager::get_remember_me_from_registry()
407407

408408
void login_manager::forgot_password(char const* url)
409409
{
410+
#ifdef WINDOWS
410411
LPCSTR params = NULL;
411412
STRCONCAT(params, "/C start ", url);
412413
ShellExecute(0, "open", "cmd.exe", params, NULL, SW_SHOW);
414+
#else
415+
std::string command = "xdg-open " + std::string{url};
416+
system(command.c_str());
417+
#endif
413418
}
414419

415420
} // namespace gamespy_gp

0 commit comments

Comments
 (0)