mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Some fixes in hotkeys and other improvements
* Save last logged character and world instead of character name * Make focused label always visible in character list and hotkeys * Other fixes in hotkeys
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
||||
bool spawnProcess(const std::string& process, const std::vector<std::string>& args);
|
||||
int getProcessId();
|
||||
std::string getTempPath();
|
||||
void copyFile(std::string from, std::string to);
|
||||
bool copyFile(std::string from, std::string to);
|
||||
void openUrl(std::string url);
|
||||
std::string getCPUName();
|
||||
double getTotalSystemMemory();
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include <string.h>
|
||||
#include <framework/stdext/stdext.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
void Platform::processArgs(std::vector<std::string>& args)
|
||||
{
|
||||
//nothing todo, linux args are already utf8 encoded
|
||||
@@ -35,6 +37,10 @@ void Platform::processArgs(std::vector<std::string>& args)
|
||||
|
||||
bool Platform::spawnProcess(const std::string& process, const std::vector<std::string>& args)
|
||||
{
|
||||
struct stat sts;
|
||||
if(stat(process.c_str(), &sts) == -1 && errno == ENOENT)
|
||||
return false;
|
||||
|
||||
pid_t pid = fork();
|
||||
if(pid == -1)
|
||||
return false;
|
||||
@@ -46,7 +52,8 @@ bool Platform::spawnProcess(const std::string& process, const std::vector<std::s
|
||||
cargs[i] = (char*)args[i-1].c_str();
|
||||
cargs[args.size()+1] = 0;
|
||||
|
||||
execv(process.c_str(), cargs);
|
||||
if(execv(process.c_str(), cargs) == -1)
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -62,9 +69,9 @@ std::string Platform::getTempPath()
|
||||
return "/tmp/";
|
||||
}
|
||||
|
||||
void Platform::copyFile(std::string from, std::string to)
|
||||
bool Platform::copyFile(std::string from, std::string to)
|
||||
{
|
||||
system(stdext::format("/bin/cp '%s' '%s'", from, to).c_str());
|
||||
return system(stdext::format("/bin/cp '%s' '%s'", from, to).c_str()) == 0;
|
||||
}
|
||||
|
||||
void Platform::openUrl(std::string url)
|
||||
|
@@ -68,11 +68,13 @@ std::string Platform::getTempPath()
|
||||
return stdext::utf16_to_utf8(path);
|
||||
}
|
||||
|
||||
void Platform::copyFile(std::string from, std::string to)
|
||||
bool Platform::copyFile(std::string from, std::string to)
|
||||
{
|
||||
boost::replace_all(from, "/", "\\");
|
||||
boost::replace_all(to, "/", "\\");
|
||||
CopyFileW(stdext::utf8_to_utf16(from).c_str(), stdext::utf8_to_utf16(to).c_str(), false);
|
||||
if(CopyFileW(stdext::utf8_to_utf16(from).c_str(), stdext::utf8_to_utf16(to).c_str(), FALSE) == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Platform::openUrl(std::string url)
|
||||
|
Reference in New Issue
Block a user