From 61450353cb8229d7ca770af56f90b6117d1d4aaa Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 18 Jan 2018 21:25:54 +0000 Subject: [PATCH] Fix build for Linux --- src/openrct2/platform/Linux.cpp | 16 ++++++++-------- src/openrct2/platform/Posix.cpp | 9 +++++++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/openrct2/platform/Linux.cpp b/src/openrct2/platform/Linux.cpp index 255345f4a3..fda75ca297 100644 --- a/src/openrct2/platform/Linux.cpp +++ b/src/openrct2/platform/Linux.cpp @@ -97,12 +97,12 @@ void platform_posix_sub_resolve_openrct_data_path(utf8 *out, size_t size) { "/var/lib/openrct2", "/usr/share/openrct2", }; - for (size_t i = 0; i < countof(searchLocations); i++) + for (auto searchLocation : searchLocations) { - log_verbose("Looking for OpenRCT2 data in %s", searchLocations[i]); - if (platform_directory_exists(searchLocations[i])) + log_verbose("Looking for OpenRCT2 data in %s", searchLocation); + if (platform_directory_exists(searchLocation)) { - safe_strcpy(out, searchLocations[i], size); + safe_strcpy(out, searchLocation, size); return; } } @@ -118,12 +118,12 @@ static void platform_posix_sub_resolve_openrct_doc_path(utf8 *out, size_t size) "./doc", "/usr/share/doc/openrct2", }; - for (size_t i = 0; i < countof(searchLocations); i++) + for (auto searchLocation : searchLocations) { - log_verbose("Looking for OpenRCT2 doc path at %s", searchLocations[i]); - if (platform_directory_exists(searchLocations[i])) + log_verbose("Looking for OpenRCT2 doc path at %s", searchLocation); + if (platform_directory_exists(searchLocation)) { - safe_strcpy(out, searchLocations[i], size); + safe_strcpy(out, searchLocation, size); return; } } diff --git a/src/openrct2/platform/Posix.cpp b/src/openrct2/platform/Posix.cpp index e3535217e7..94c9c2072a 100644 --- a/src/openrct2/platform/Posix.cpp +++ b/src/openrct2/platform/Posix.cpp @@ -44,6 +44,9 @@ #define FILE_BUFFER_SIZE 4096 +extern "C" +{ + static utf8 _userDataDirectoryPath[MAX_PATH] = { 0 }; static utf8 _openrctDataDirectoryPath[MAX_PATH] = { 0 }; @@ -149,7 +152,7 @@ bool platform_original_game_data_exists(const utf8 *path) return platform_file_exists(checkPath); } -static mode_t getumask() +static mode_t openrct2_getumask() { mode_t mask = umask(0); umask(mask); @@ -158,7 +161,7 @@ static mode_t getumask() bool platform_ensure_directory_exists(const utf8 *path) { - mode_t mask = getumask(); + mode_t mask = openrct2_getumask(); char buffer[MAX_PATH]; platform_utf8_to_multibyte(path, buffer, MAX_PATH); @@ -508,4 +511,6 @@ bool platform_process_is_elevated() #endif // __EMSCRIPTEN__ } +} // extern "C" + #endif