mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Make sure config.ini gets created
This commit makes sure config.ini gets created even when RCT2 path is not selected. This makes for a better out-of-box experience on Linux, where no directory selector is provided yet, as we provide default config file and state in the error message how to fix it.
This commit is contained in:
16
src/config.c
16
src/config.c
@@ -306,8 +306,8 @@ notification_configuration gConfigNotifications;
|
||||
themes_configuration gConfigThemes;
|
||||
title_sequences_configuration gConfigTitleSequences;
|
||||
|
||||
bool config_open(const utf8string path);
|
||||
bool config_save(const utf8string path);
|
||||
static bool config_open(const utf8string path);
|
||||
static bool config_save(const utf8string path);
|
||||
static void config_read_properties(config_section_definition **currentSection, const_utf8string line);
|
||||
static void config_save_property_value(SDL_RWops *file, uint8 type, value_union *value);
|
||||
static bool config_read_enum(void *dest, int destSize, const utf8 *key, int keySize, config_enum_definition *enumDefinitions);
|
||||
@@ -396,12 +396,17 @@ void config_set_defaults()
|
||||
}
|
||||
}
|
||||
|
||||
void config_get_default_path(utf8 *outPath)
|
||||
{
|
||||
platform_get_user_directory(outPath, NULL);
|
||||
strcat(outPath, "config.ini");
|
||||
}
|
||||
|
||||
bool config_open_default()
|
||||
{
|
||||
utf8 path[MAX_PATH];
|
||||
|
||||
platform_get_user_directory(path, NULL);
|
||||
strcat(path, "config.ini");
|
||||
config_get_default_path(path);
|
||||
if (config_open(path)) {
|
||||
config_apply_to_old_addresses();
|
||||
return true;
|
||||
@@ -414,8 +419,7 @@ bool config_save_default()
|
||||
{
|
||||
utf8 path[MAX_PATH];
|
||||
|
||||
platform_get_user_directory(path, NULL);
|
||||
strcat(path, "config.ini");
|
||||
config_get_default_path(path);
|
||||
if (config_save(path)) {
|
||||
config_apply_to_old_addresses();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user