Skip to content

Commit

Permalink
Merge pull request #44 from JosJuice/non-windows-system
Browse files Browse the repository at this point in the history
Fix _wsystem compilation error on non-Windows OSes
  • Loading branch information
NikhilNarayana authored Jun 24, 2020
2 parents 1d8ada8 + e53188b commit ab57197
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Source/Core/Core/Slippi/SlippiUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ static int system_hidden(const char *cmd)
}
#endif

static void RunSystemCommand(const std::string& command)
{
#ifdef _WIN32
_wsystem(UTF8ToUTF16(command).c_str());
#else
system(command.c_str());
#endif
}

SlippiUser::~SlippiUser()
{
// Wait for thread to terminate
Expand Down Expand Up @@ -120,8 +129,7 @@ void SlippiUser::OpenLogInPage()
std::string command = "xdg-open \"" + fullUrl + "\""; // Linux
#endif

std::wstring convertedCommand = std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(command);
_wsystem(convertedCommand.c_str());
RunSystemCommand(command);
}

void SlippiUser::UpdateFile()
Expand All @@ -141,8 +149,7 @@ void SlippiUser::UpdateApp()
std::string path = File::GetExeDirectory() + "/dolphin-slippi-tools.exe";
std::string command = "start \"Updating Dolphin\" \"" + path + "\" app-update -launch -iso \"" + isoPath + "\"";
WARN_LOG(SLIPPI, "Executing app update command: %s", command);
std::wstring convertedCommand = std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(command);
_wsystem(convertedCommand.c_str());
RunSystemCommand(command);
#endif
}

Expand Down

0 comments on commit ab57197

Please sign in to comment.