Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined macro _WIN32
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user