summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2018-12-09 02:28:14 +0100
committerglx22 <glx22@users.noreply.github.com>2018-12-27 18:09:16 +0100
commitc540d7244531d501f16b485a3e45e358f98853be (patch)
tree4d270f06b2aa9b4f796d4828e5bfaf3c09cdd4b1 /src/fileio.cpp
parent8890926b0d1069aec7ef53fd84868a7a3ca02c05 (diff)
downloadopenttd-c540d7244531d501f16b485a3e45e358f98853be.tar.xz
Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r--src/fileio.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 5530965e9..0e6d86e3c 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -15,7 +15,7 @@
#include "fios.h"
#include "string_func.h"
#include "tar_type.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
# define access _taccess
#elif defined(__HAIKU__)
@@ -361,7 +361,7 @@ char *FioFindFullPath(char *buf, const char *last, Subdirectory subdir, const ch
FOR_ALL_SEARCHPATHS(sp) {
FioGetFullPath(buf, last, sp, subdir, filename);
if (FileExists(buf)) return buf;
-#if !defined(WIN32)
+#if !defined(_WIN32)
/* Be, as opening files, aware that sometimes the filename
* might be in uppercase when it is in lowercase on the
* disk. Of course Windows doesn't care about casing. */
@@ -399,7 +399,7 @@ char *FioGetDirectory(char *buf, const char *last, Subdirectory subdir)
static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subdirectory subdir, size_t *filesize)
{
-#if defined(WIN32) && defined(UNICODE)
+#if defined(_WIN32) && defined(UNICODE)
/* fopen is implemented as a define with ellipses for
* Unicode support (prepend an L). As we are not sending
* a string, but a variable, it 'renames' the variable,
@@ -416,12 +416,12 @@ static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath s
seprintf(buf, lastof(buf), "%s%s%s", _searchpaths[sp], _subdirs[subdir], filename);
}
-#if defined(WIN32)
+#if defined(_WIN32)
if (mode[0] == 'r' && GetFileAttributes(OTTD2FS(buf)) == INVALID_FILE_ATTRIBUTES) return NULL;
#endif
f = fopen(buf, mode);
-#if !defined(WIN32)
+#if !defined(_WIN32)
if (f == NULL && strtolower(buf + ((subdir == NO_DIRECTORY) ? 0 : strlen(_searchpaths[sp]) - 1))) {
f = fopen(buf, mode);
}
@@ -535,7 +535,7 @@ void FioCreateDirectory(const char *name)
{
/* Ignore directory creation errors; they'll surface later on, and most
* of the time they are 'directory already exists' errors anyhow. */
-#if defined(WIN32)
+#if defined(_WIN32)
CreateDirectory(OTTD2FS(name), NULL);
#elif defined(OS2) && !defined(__INNOTEK_LIBC__)
mkdir(OTTD2FS(name));
@@ -979,14 +979,14 @@ bool ExtractTar(const char *tar_filename, Subdirectory subdir)
return true;
}
-#if defined(WIN32)
+#if defined(_WIN32)
/**
* Determine the base (personal dir and game data dir) paths
* @param exe the path from the current path to the executable
* @note defined in the OS related files (os2.cpp, win32.cpp, unix.cpp etc)
*/
extern void DetermineBasePaths(const char *exe);
-#else /* defined(WIN32) */
+#else /* defined(_WIN32) */
/**
* Changes the working directory to the path of the give executable.
@@ -1149,7 +1149,7 @@ extern void cocoaSetApplicationBundleDir();
_searchpaths[SP_APPLICATION_BUNDLE_DIR] = NULL;
#endif
}
-#endif /* defined(WIN32) */
+#endif /* defined(_WIN32) */
const char *_personal_dir;