mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
Add live_textures_reload command
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <framework/stdext/types.h>
|
||||
|
||||
class Platform
|
||||
{
|
||||
@@ -39,11 +40,11 @@ public:
|
||||
bool copyFile(std::string from, std::string to);
|
||||
bool fileExists(std::string file);
|
||||
bool removeFile(std::string file);
|
||||
ticks_t getFileModificationTime(std::string file);
|
||||
void openUrl(std::string url);
|
||||
std::string getCPUName();
|
||||
double getTotalSystemMemory();
|
||||
std::string getOSName();
|
||||
time_t getFileModificationTime(const std::string& filename);
|
||||
};
|
||||
|
||||
extern Platform g_platform;
|
||||
|
@@ -108,6 +108,14 @@ bool Platform::removeFile(std::string file)
|
||||
return false;
|
||||
}
|
||||
|
||||
ticks_t Platform::getFileModificationTime(std::string file)
|
||||
{
|
||||
struct stat attrib;
|
||||
if(stat(file.c_str(), &attrib) == 0)
|
||||
return attrib.st_mtime;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Platform::openUrl(std::string url)
|
||||
{
|
||||
if(url.find("http://") == std::string::npos)
|
||||
@@ -160,15 +168,5 @@ std::string Platform::getOSName()
|
||||
return std::string();
|
||||
}
|
||||
|
||||
time_t Platform::getFileModificationTime(const std::string& filename)
|
||||
{
|
||||
struct stat attrib;
|
||||
if(stat(filename.c_str(), &attrib))
|
||||
perror(filename.c_str());
|
||||
else
|
||||
return attrib.st_mtime;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -132,6 +132,19 @@ bool Platform::removeFile(std::string file)
|
||||
return true;
|
||||
}
|
||||
|
||||
ticks_t Platform::getFileModificationTime(std::string file)
|
||||
{
|
||||
boost::replace_all(file, "/", "\\");
|
||||
std::wstring wfile = stdext::utf8_to_utf16(file);
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileAttrData;
|
||||
memset(&fileAttrData, 0, sizeof(fileAttrData));
|
||||
GetFileAttributesExW(wfile.c_str(), GetFileExInfoStandard, &fileAttrData);
|
||||
ULARGE_INTEGER uli;
|
||||
uli.LowPart = fileAttrData.ftLastWriteTime.dwLowDateTime;
|
||||
uli.HighPart = fileAttrData.ftLastWriteTime.dwHighDateTime;
|
||||
return uli.QuadPart;
|
||||
}
|
||||
|
||||
void Platform::openUrl(std::string url)
|
||||
{
|
||||
if(url.find("http://") == std::string::npos)
|
||||
@@ -401,13 +414,4 @@ std::string Platform::getOSName()
|
||||
return ret;
|
||||
}
|
||||
|
||||
time_t Platform::getFileModificationTime(const std::string& filename)
|
||||
{
|
||||
//TODO
|
||||
/*WIN32_FILE_ATTRIBUTE_DATA fileAttrData = {0};
|
||||
GetFileAttributesEx(filename.c_str(), GetFileExInfoStandard, &fileAttrData);
|
||||
return fileAttrData.ftLastWriteTime;*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user