Implement platform-specific changelog path funcs

This commit is contained in:
rwjuk 2017-08-02 21:39:27 +01:00 committed by Michał Janiszewski
parent 972120e35a
commit 4132b85c02
4 changed files with 15 additions and 2 deletions

View File

@ -128,6 +128,7 @@ uint8 platform_get_locale_measurement_format();
uint8 platform_get_locale_temperature_format();
uint8 platform_get_locale_date_format();
bool platform_process_is_elevated();
void platform_get_changelog_path(utf8 *outPath, size_t outSize);
#ifndef NO_TTF
bool platform_get_font_path(TTFFontDescriptor *font, utf8 *buffer, size_t size);

View File

@ -842,4 +842,11 @@ bool platform_process_is_elevated()
return (geteuid() == 0);
}
void platform_get_changelog_path(utf8 *outPath, size_t outSize)
{
platform_get_openrct_data_path(outPath, outSize);
safe_strcat_path(outPath, "changelog.txt", outSize);
}
#endif

View File

@ -454,6 +454,12 @@ void platform_get_openrct_data_path(utf8 *outPath, size_t outSize)
safe_strcpy(outPath, _openrctDataDirectoryPath, outSize);
}
void platform_get_changelog_path(utf8 *outPath, size_t outSize)
{
safe_strcpy(outPath, gExePath, outSize);
safe_strcat_path(outPath, "changelog.txt", outSize);
}
/**
* Default directory fallback is:
* - (command line argument)

View File

@ -204,8 +204,7 @@ static bool window_changelog_read_file()
{
window_changelog_dispose_file();
utf8 path[MAX_PATH];
platform_get_openrct_data_path(path, sizeof(path));
safe_strcat_path(path, "changelog.txt", MAX_PATH);
platform_get_changelog_path(path, sizeof(path));
if (!readentirefile(path, (void**)&_changelogText, &_changelogTextSize)) {
log_error("Unable to read changelog.txt");
return false;