Fix build for Linux

This commit is contained in:
Ted John 2018-01-18 21:25:54 +00:00
parent f551a150fe
commit 61450353cb
2 changed files with 15 additions and 10 deletions

View File

@ -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;
}
}

View File

@ -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