mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 13:03:27 +02:00
Minor fixes and improvements
This commit is contained in:
@@ -71,7 +71,6 @@ void ProtocolGame::onRecv(const InputMessagePtr& inputMessage)
|
||||
|
||||
void ProtocolGame::onError(const boost::system::error_code& error)
|
||||
{
|
||||
Protocol::onError(error);
|
||||
|
||||
g_game.processConnectionError(error);
|
||||
disconnect();
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class Platform
|
||||
{
|
||||
public:
|
||||
void processArgs(std::vector<std::string>& args);
|
||||
bool spawnProcess(const std::string& process, const std::vector<std::string>& args);
|
||||
bool spawnProcess(std::string process, const std::vector<std::string>& args);
|
||||
int getProcessId();
|
||||
bool isProcessRunning(const std::string& name);
|
||||
bool killProcess(const std::string& name);
|
||||
|
@@ -35,7 +35,7 @@ void Platform::processArgs(std::vector<std::string>& args)
|
||||
//nothing todo, linux args are already utf8 encoded
|
||||
}
|
||||
|
||||
bool Platform::spawnProcess(const std::string& process, const std::vector<std::string>& args)
|
||||
bool Platform::spawnProcess(std::string process, const std::vector<std::string>& args)
|
||||
{
|
||||
struct stat sts;
|
||||
if(stat(process.c_str(), &sts) == -1 && errno == ENOENT)
|
||||
|
@@ -42,11 +42,16 @@ void Platform::processArgs(std::vector<std::string>& args)
|
||||
}
|
||||
}
|
||||
|
||||
bool Platform::spawnProcess(const std::string& process, const std::vector<std::string>& args)
|
||||
bool Platform::spawnProcess(std::string process, const std::vector<std::string>& args)
|
||||
{
|
||||
std::string commandLine;
|
||||
for(uint i = 0; i < args.size(); ++i)
|
||||
commandLine += stdext::format(" \"%s\"", args[i]);
|
||||
|
||||
boost::replace_all(process, "/", "\\");
|
||||
if(!boost::ends_with(process, ".exe"))
|
||||
process += ".exe";
|
||||
|
||||
std::wstring wfile = stdext::utf8_to_utf16(process);
|
||||
std::wstring wcommandLine = stdext::utf8_to_utf16(commandLine);
|
||||
|
||||
@@ -83,9 +88,12 @@ bool Platform::killProcess(const std::string& name)
|
||||
|
||||
std::string Platform::getTempPath()
|
||||
{
|
||||
std::string ret;
|
||||
wchar_t path[MAX_PATH];
|
||||
GetTempPathW(MAX_PATH, path);
|
||||
return stdext::utf16_to_utf8(path);
|
||||
ret = stdext::utf16_to_utf8(path);
|
||||
boost::replace_all(ret, "\\", "/");
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string Platform::getCurrentDir()
|
||||
|
Reference in New Issue
Block a user