From 029234432846668efd9938e0f5bbd37d76dc2311 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 26 Jun 2021 01:05:56 -0400 Subject: [PATCH] Fix Windows compile error, switch std::string to ByteString --- src/common/Platform.cpp | 15 ++++++++------- src/common/Platform.h | 14 +++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/common/Platform.cpp b/src/common/Platform.cpp index f6f326423..31a3998ff 100644 --- a/src/common/Platform.cpp +++ b/src/common/Platform.cpp @@ -10,6 +10,7 @@ #ifdef WIN #define NOMINMAX #include +#include #include #include #include @@ -28,7 +29,7 @@ namespace Platform { -std::string GetCwd() +ByteString GetCwd() { char cwdTemp[PATH_MAX]; getcwd(cwdTemp, PATH_MAX); @@ -187,7 +188,7 @@ void LoadFileInResource(int name, int type, unsigned int& size, const char*& dat #endif } -bool Stat(std::string filename) +bool Stat(ByteString filename) { #ifdef WIN struct _stat s; @@ -205,7 +206,7 @@ bool Stat(std::string filename) } } -bool FileExists(std::string filename) +bool FileExists(ByteString filename) { #ifdef WIN struct _stat s; @@ -230,7 +231,7 @@ bool FileExists(std::string filename) } } -bool DirectoryExists(std::string directory) +bool DirectoryExists(ByteString directory) { #ifdef WIN struct _stat s; @@ -255,12 +256,12 @@ bool DirectoryExists(std::string directory) } } -bool DeleteFile(std::string filename) +bool DeleteFile(ByteString filename) { return std::remove(filename.c_str()) == 0; } -bool DeleteDirectory(std::string folder) +bool DeleteDirectory(ByteString folder) { #ifdef WIN return _rmdir(folder.c_str()) == 0; @@ -269,7 +270,7 @@ bool DeleteDirectory(std::string folder) #endif } -bool MakeDirectory(std::string dir) +bool MakeDirectory(ByteString dir) { #ifdef WIN return _mkdir(dir.c_str()) == 0; diff --git a/src/common/Platform.h b/src/common/Platform.h index 73da395b0..3e593b930 100644 --- a/src/common/Platform.h +++ b/src/common/Platform.h @@ -10,7 +10,7 @@ namespace Platform { - std::string GetCwd(); + ByteString GetCwd(); ByteString ExecutableName(); void DoRestart(); @@ -21,23 +21,23 @@ namespace Platform void LoadFileInResource(int name, int type, unsigned int& size, const char*& data); - bool Stat(std::string filename); - bool FileExists(std::string filename); - bool DirectoryExists(std::string directory); + bool Stat(ByteString filename); + bool FileExists(ByteString filename); + bool DirectoryExists(ByteString directory); /** * @return true on success */ - bool DeleteFile(std::string filename); + bool DeleteFile(ByteString filename); /** * @return true on success */ - bool DeleteDirectory(std::string folder); + bool DeleteDirectory(ByteString folder); /** * @return true on success */ - bool MakeDirectory(std::string dir); + bool MakeDirectory(ByteString dir); std::vector DirectorySearch(ByteString directory, ByteString search, std::vector extensions); #ifdef WIN