diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index b6bdd25ad1..e5fef0c8f0 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -2,6 +2,7 @@ // This is quite messy due to platform-specific implementations and #ifdef's. // If your platform is not supported, it is suggested to use Qt instead. +#include #include #include @@ -199,9 +200,19 @@ void OpenDirectory(const char *path) { SHOpenFolderAndSelectItems(pidl, 0, NULL, 0); CoTaskMemFree(pidl); } -#elif PPSSPP_PLATFORM(MAC) - std::string command = std::string("open ") + path; - system(command.c_str()); +#elif PPSSPP_PLATFORM(MAC) || (PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID)) + pid_t pid = fork(); + if (pid < 0) + return; + + if (pid == 0) { +#if PPSSPP_PLATFORM(MAC) + execlp("open", "open", path, nullptr); +#else + execlp("xdg-open", "xdg-open", path, nullptr); +#endif + exit(1); + } #endif }