mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
fix open in folder on macOS, avoid spawning the open command to open URLs (#17342)
* fix open in folder on macOS, avoid spawning the open command to open URLs * fix indent * goober alert * no more goober * fix compiler failing on linux
This commit is contained in:
1 parent
4d4881fcde
commit
f87bfda8d3
3 files changed
+22
-10
No files matched your search
+7
-10
@@ -271,20 +271,18 @@ void System_ShowFileInFolder(const char *path) {
|
||||
SHOpenFolderAndSelectItems(pidl, 0, NULL, 0);
|
||||
CoTaskMemFree(pidl);
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(MAC) || (PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID))
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
OSXShowInFinder(path);
|
||||
#elif (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
|
||||
#endif /* PPSSPP_PLATFORM(WINDOWS) */
|
||||
}
|
||||
|
||||
void System_LaunchUrl(LaunchUrlType urlType, const char *url) {
|
||||
@@ -303,8 +301,7 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) {
|
||||
std::wstring wurl = ConvertUTF8ToWString(url);
|
||||
ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif defined(__APPLE__)
|
||||
std::string command = std::string("open ") + url;
|
||||
system(command.c_str());
|
||||
OSXOpenURL(url);
|
||||
#else
|
||||
std::string command = std::string("xdg-open ") + url;
|
||||
int err = system(command.c_str());
|
||||
@@ -322,8 +319,8 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) {
|
||||
std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(url);
|
||||
ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
#elif defined(__APPLE__)
|
||||
std::string command = std::string("open mailto:") + url;
|
||||
system(command.c_str());
|
||||
std::string mailToURL = std::string("mailto:") + url;
|
||||
OSXOpenURL(mailToURL.c_str());
|
||||
#else
|
||||
std::string command = std::string("xdg-email ") + url;
|
||||
int err = system(command.c_str());
|
||||
|
||||
Reference in new issue
Block a user