diff --git a/src/game.cc b/src/game.cc index 01c87ec..5383fa4 100644 --- a/src/game.cc +++ b/src/game.cc @@ -3,12 +3,6 @@ #include #include -#ifdef _WIN32 -#include -#else -#include // access -#endif - #include "actions.h" #include "animation.h" #include "art.h" @@ -1336,12 +1330,12 @@ static int gameDbInit() for (patch_index = 0; patch_index < 1000; patch_index++) { snprintf(filename, sizeof(filename), "patch%03d.dat", patch_index); - if (access(filename, 0) == 0) { + if (compat_access(filename, 0) == 0) { dbOpen(filename, 0, NULL, 1); } } - if (access("f2_res.dat", 0) == 0) { + if (compat_access("f2_res.dat", 0) == 0) { dbOpen("f2_res.dat", 0, NULL, 1); } diff --git a/src/platform_compat.cc b/src/platform_compat.cc index e47e974..7a8f425 100644 --- a/src/platform_compat.cc +++ b/src/platform_compat.cc @@ -364,6 +364,15 @@ void compat_resolve_path(char* path) #endif } +int compat_access(const char* path, int mode) +{ + char nativePath[COMPAT_MAX_PATH]; + strcpy(nativePath, path); + compat_windows_path_to_native(nativePath); + compat_resolve_path(nativePath); + return access(nativePath, mode); +} + char* compat_strdup(const char* string) { return SDL_strdup(string); diff --git a/src/platform_compat.h b/src/platform_compat.h index 345a500..66db2bc 100644 --- a/src/platform_compat.h +++ b/src/platform_compat.h @@ -41,6 +41,7 @@ int compat_remove(const char* path); int compat_rename(const char* oldFileName, const char* newFileName); void compat_windows_path_to_native(char* path); void compat_resolve_path(char* path); +int compat_access(const char* path, int mode); char* compat_strdup(const char* string); long getFileSize(FILE* stream);