Add quotes around xdg-open and open commands to support paths with spaces

This commit is contained in:
Mr-Wiseguy 2025-04-24 17:57:12 -04:00
parent ebd11b2d84
commit ad586e388e

View file

@ -235,10 +235,10 @@ void ModMenu::open_mods_folder() {
std::wstring path_wstr = mods_directory.wstring(); std::wstring path_wstr = mods_directory.wstring();
ShellExecuteW(NULL, L"open", path_wstr.c_str(), NULL, NULL, SW_SHOWDEFAULT); ShellExecuteW(NULL, L"open", path_wstr.c_str(), NULL, NULL, SW_SHOWDEFAULT);
#elif defined(__linux__) #elif defined(__linux__)
std::string command = "xdg-open " + mods_directory.string() + " &"; std::string command = "xdg-open \"" + mods_directory.string() + "\" &";
std::system(command.c_str()); std::system(command.c_str());
#elif defined(__APPLE__) #elif defined(__APPLE__)
std::string command = "open " + mods_directory.string(); std::string command = "open \"" + mods_directory.string() + "\"";
std::system(command.c_str()); std::system(command.c_str());
#else #else
static_assert(false, "Not implemented for this platform."); static_assert(false, "Not implemented for this platform.");