mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
Remove boost::filesystem dependency
This commit is contained in:
@@ -35,6 +35,7 @@ public:
|
||||
bool isProcessRunning(const std::string& name);
|
||||
bool killProcess(const std::string& name);
|
||||
std::string getTempPath();
|
||||
std::string getCurrentDir();
|
||||
bool copyFile(std::string from, std::string to);
|
||||
bool fileExists(const std::string& file);
|
||||
void openUrl(std::string url);
|
||||
|
@@ -79,6 +79,15 @@ std::string Platform::getTempPath()
|
||||
return "/tmp/";
|
||||
}
|
||||
|
||||
std::string Platform::getCurrentDir()
|
||||
{
|
||||
std::string res;
|
||||
char cwd[2048];
|
||||
if(getcwd(cwd, sizeof(cwd)) != NULL)
|
||||
res = cwd;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool Platform::copyFile(std::string from, std::string to)
|
||||
{
|
||||
return system(stdext::format("/bin/cp '%s' '%s'", from, to).c_str()) == 0;
|
||||
|
@@ -88,6 +88,16 @@ std::string Platform::getTempPath()
|
||||
return stdext::utf16_to_utf8(path);
|
||||
}
|
||||
|
||||
std::string Platform::getCurrentDir()
|
||||
{
|
||||
std::string ret;
|
||||
wchar_t path[MAX_PATH];
|
||||
GetCurrentDirectoryW(MAX_PATH, path);
|
||||
ret = stdext::utf16_to_utf8(path);
|
||||
boost::replace_all(ret, "\\", "/");
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Platform::fileExists(const std::string& file)
|
||||
{
|
||||
std::wstring wfile = stdext::utf8_to_utf16(file);
|
||||
|
Reference in New Issue
Block a user