Minor fixes and improvements

This commit is contained in:
Eduardo Bart
2013-02-27 16:24:32 -03:00
parent 46aa0c005f
commit e528fcc8f8
19 changed files with 69 additions and 31 deletions

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -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)

View File

@@ -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()