diff options
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/files.cpp | 12 | ||||
-rw-r--r-- | src/fs/mkdir.cpp | 10 | ||||
-rw-r--r-- | src/fs/paths.cpp | 28 | ||||
-rw-r--r-- | src/fs/specialfolder.cpp | 4 | ||||
-rw-r--r-- | src/fs/specialfolder.h | 4 | ||||
-rw-r--r-- | src/fs/virtfs/fs.cpp | 6 | ||||
-rw-r--r-- | src/fs/virtfs/fsdir.cpp | 20 | ||||
-rw-r--r-- | src/fs/virtfs/rwops.cpp | 1 |
8 files changed, 43 insertions, 42 deletions
diff --git a/src/fs/files.cpp b/src/fs/files.cpp index 5a041b698..5134520ce 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -60,7 +60,7 @@ void Files::extractLocale() const std::string dir = pathJoin("locale", *i); if (VirtFs::isDirectory(dir)) { - const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo"; + const std::string moFile = dir + "/LC_MESSAGES/manaverse.mo"; if (VirtFs::exists((moFile))) { const std::string localFile = pathJoin(localDir, moFile); @@ -209,7 +209,7 @@ int Files::copyFile(const std::string &restrict srcName, bool Files::existsLocal(const std::string &path) { struct stat statbuf; -#ifdef WIN32 +#ifdef _WIN32 // in windows path\file.ext\ by default detected as exists // if file.ext is not directory, need return false const bool res = (stat(path.c_str(), &statbuf) == 0); @@ -221,9 +221,9 @@ bool Files::existsLocal(const std::string &path) return false; } return true; -#else // WIN32 +#else // _WIN32 return stat(path.c_str(), &statbuf) == 0; -#endif // WIN32 +#endif // _WIN32 } bool Files::loadTextFileLocal(const std::string &fileName, @@ -303,7 +303,7 @@ void Files::enumFiles(StringVect &files, const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (skipSymlinks == true) { struct stat statbuf; @@ -313,7 +313,7 @@ void Files::enumFiles(StringVect &files, continue; } } -#endif // WIN32 +#endif // _WIN32 files.push_back(file); } closedir(dir); diff --git a/src/fs/mkdir.cpp b/src/fs/mkdir.cpp index ee344324c..45a025c6a 100644 --- a/src/fs/mkdir.cpp +++ b/src/fs/mkdir.cpp @@ -24,16 +24,16 @@ #include "utils/cast.h" -#if defined WIN32 +#if defined _WIN32 #include <limits.h> #include <windows.h> -#endif // defined WIN32 +#endif // defined _WIN32 #include <sys/stat.h> #include "debug.h" -#if defined WIN32 +#if defined _WIN32 int mkdir_r(const char *const pathname) { if (!pathname) @@ -103,7 +103,7 @@ int mkdir_r(const char *const pathname) } return 0; } -#else // WIN32 +#else // _WIN32 /// Create a directory, making leading components first if necessary int mkdir_r(const char *const pathname) @@ -164,4 +164,4 @@ int mkdir_r(const char *const pathname) delete []tmp; return 0; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp index 897d2ff41..492f5a449 100644 --- a/src/fs/paths.cpp +++ b/src/fs/paths.cpp @@ -42,22 +42,22 @@ #define realpath(N, R) strcpy(R, N) #endif // __native_client__ -#ifdef WIN32 +#ifdef _WIN32 #include "fs/specialfolder.h" #define realpath(N, R) _fullpath((R), (N), _MAX_PATH) -#endif +#endif // _WIN32 #if defined __OpenBSD__ #include <limits> #else #include <climits> -#endif // WIN32 +#endif // __OpenBSD__ -#ifndef WIN32 +#ifndef _WIN32 #include <unistd.h> #include <sys/types.h> #include <pwd.h> -#endif // WIN32 +#endif // _WIN32 PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") @@ -148,7 +148,7 @@ void prepareFsPath(std::string &path) std::string &fixDirSeparators(std::string &str) { -#ifdef WIN32 +#ifdef _WIN32 return replaceAll(str, "/", "\\"); #else return str; @@ -169,7 +169,7 @@ std::string removeLast(const std::string &str) return str; } -#ifdef WIN32 +#ifdef _WIN32 std::string getSelfName() { return "manaplus.exe"; @@ -195,18 +195,18 @@ std::string getSelfName() return ""; } -#else // WIN32 +#else // _WIN32 std::string getSelfName() { return ""; } -#endif // WIN32 +#endif // _WIN32 std::string getPicturesDir() { -#ifdef WIN32 +#ifdef _WIN32 std::string dir = getSpecialFolderLocation(CSIDL_MYPICTURES); if (dir.empty()) dir = getSpecialFolderLocation(CSIDL_DESKTOP); @@ -244,7 +244,7 @@ std::string getPicturesDir() } } } -#endif // WIN32 +#endif // _WIN32 return pathJoin(VirtFs::getUserDir(), "Desktop"); } @@ -257,11 +257,11 @@ std::string getHomePath() dir += dirSeparator; return dir; #else // defined(UNITTESTS) && defined(UNITESTSDIR) -#ifdef WIN32 +#ifdef _WIN32 return getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); #elif defined(__SWITCH__) return VirtFs::getBaseDir(); -#else +#else // _WIN32 const char *path = getenv("HOME"); if (path == nullptr) { @@ -279,7 +279,7 @@ std::string getHomePath() if (findLast(dir, std::string(dirSeparator)) == false) dir += dirSeparator; return dir; -#endif // WIN32 +#endif // _WIN32 #endif // defined(UNITTESTS) && defined(UNITESTSDIR) } diff --git a/src/fs/specialfolder.cpp b/src/fs/specialfolder.cpp index 807ea093b..34e37aec6 100644 --- a/src/fs/specialfolder.cpp +++ b/src/fs/specialfolder.cpp @@ -20,7 +20,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef WIN32 +#ifdef _WIN32 #include "fs/specialfolder.h" #include <windows.h> @@ -57,4 +57,4 @@ std::string getSpecialFolderLocation(const int folderId) return ret; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/fs/specialfolder.h b/src/fs/specialfolder.h index 618a2d90d..832750768 100644 --- a/src/fs/specialfolder.h +++ b/src/fs/specialfolder.h @@ -23,12 +23,12 @@ #ifndef UTILS_SPECIALFOLDER_H #define UTILS_SPECIALFOLDER_H -#ifdef WIN32 +#ifdef _WIN32 #include <shlobj.h> #include <string> #include "localconsts.h" std::string getSpecialFolderLocation(const int folderId) A_WARN_UNUSED; -#endif // WIN32 +#endif // _WIN32 #endif // UTILS_SPECIALFOLDER_H diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp index 42b93188e..13d15eb09 100644 --- a/src/fs/virtfs/fs.cpp +++ b/src/fs/virtfs/fs.cpp @@ -64,11 +64,11 @@ namespace VirtFs void updateDirSeparator() { -#ifdef WIN32 +#ifdef _WIN32 dirSeparator = "\\"; -#else // WIN32 +#else // _WIN32 dirSeparator = "/"; -#endif // WIN32 +#endif // _WIN32 } const char *getDirSeparator() diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp index 7832dcce6..c623638ca 100644 --- a/src/fs/virtfs/fsdir.cpp +++ b/src/fs/virtfs/fsdir.cpp @@ -204,7 +204,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { struct stat statbuf; @@ -214,7 +214,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 bool found(false); FOR_EACH (StringVectCIter, itn, names) @@ -256,7 +256,7 @@ namespace FsDir name.c_str()) return false; } -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) return false; @@ -265,7 +265,7 @@ namespace FsDir S_ISLNK(statbuf.st_mode) != 0; #else return false; -#endif // WIN32 +#endif // _WIN32 } void freeList(List *restrict const handle) @@ -549,7 +549,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -558,7 +558,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) @@ -599,7 +599,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -608,7 +608,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) @@ -649,7 +649,7 @@ namespace FsDir const std::string file = next_file->d_name; if (file == "." || file == "..") continue; -#ifndef WIN32 +#ifndef _WIN32 if (mPermitLinks == false) { if (lstat(path.c_str(), &statbuf) == 0 && @@ -658,7 +658,7 @@ namespace FsDir continue; } } -#endif // WIN32 +#endif // _WIN32 const std::string filePath = pathJoin(path, file); if (stat(filePath.c_str(), &statbuf) == 0) diff --git a/src/fs/virtfs/rwops.cpp b/src/fs/virtfs/rwops.cpp index f4984b547..d710dc1d7 100644 --- a/src/fs/virtfs/rwops.cpp +++ b/src/fs/virtfs/rwops.cpp @@ -52,6 +52,7 @@ #include "utils/checkutils.h" #include "utils/fuzzer.h" +#include "utils/performance.h" PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") |