mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #2703 from janisozaur/config
Make sure config.ini gets created
This commit is contained in:
commit
cdc2bec135
16
src/config.c
16
src/config.c
|
@ -306,8 +306,8 @@ notification_configuration gConfigNotifications;
|
||||||
themes_configuration gConfigThemes;
|
themes_configuration gConfigThemes;
|
||||||
title_sequences_configuration gConfigTitleSequences;
|
title_sequences_configuration gConfigTitleSequences;
|
||||||
|
|
||||||
bool config_open(const utf8string path);
|
static bool config_open(const utf8string path);
|
||||||
bool config_save(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_read_properties(config_section_definition **currentSection, const_utf8string line);
|
||||||
static void config_save_property_value(SDL_RWops *file, uint8 type, value_union *value);
|
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);
|
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()
|
bool config_open_default()
|
||||||
{
|
{
|
||||||
utf8 path[MAX_PATH];
|
utf8 path[MAX_PATH];
|
||||||
|
|
||||||
platform_get_user_directory(path, NULL);
|
config_get_default_path(path);
|
||||||
strcat(path, "config.ini");
|
|
||||||
if (config_open(path)) {
|
if (config_open(path)) {
|
||||||
config_apply_to_old_addresses();
|
config_apply_to_old_addresses();
|
||||||
return true;
|
return true;
|
||||||
|
@ -414,8 +419,7 @@ bool config_save_default()
|
||||||
{
|
{
|
||||||
utf8 path[MAX_PATH];
|
utf8 path[MAX_PATH];
|
||||||
|
|
||||||
platform_get_user_directory(path, NULL);
|
config_get_default_path(path);
|
||||||
strcat(path, "config.ini");
|
|
||||||
if (config_save(path)) {
|
if (config_save(path)) {
|
||||||
config_apply_to_old_addresses();
|
config_apply_to_old_addresses();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -337,6 +337,7 @@ extern title_sequences_configuration gConfigTitleSequences;
|
||||||
|
|
||||||
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
|
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
|
||||||
|
|
||||||
|
void config_get_default_path(utf8 *outPath);
|
||||||
void config_set_defaults();
|
void config_set_defaults();
|
||||||
bool config_open_default();
|
bool config_open_default();
|
||||||
bool config_save_default();
|
bool config_save_default();
|
||||||
|
|
|
@ -196,7 +196,11 @@ bool openrct2_initialise()
|
||||||
config_set_defaults();
|
config_set_defaults();
|
||||||
if (!config_open_default()) {
|
if (!config_open_default()) {
|
||||||
if (!config_find_or_browse_install_directory()) {
|
if (!config_find_or_browse_install_directory()) {
|
||||||
log_fatal("An RCT2 install directory must be specified!");
|
gConfigGeneral.last_run_version = strndup(OPENRCT2_VERSION, strlen(OPENRCT2_VERSION));
|
||||||
|
config_save_default();
|
||||||
|
utf8 path[MAX_PATH];
|
||||||
|
config_get_default_path(path);
|
||||||
|
log_fatal("An RCT2 install directory must be specified! Please edit \"game_path\" in %s.", path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,9 @@ int rct2_init_directories()
|
||||||
if (!platform_original_game_data_exists(gConfigGeneral.game_path)) {
|
if (!platform_original_game_data_exists(gConfigGeneral.game_path)) {
|
||||||
log_verbose("install directory does not exist or invalid directory selected, %s", gConfigGeneral.game_path);
|
log_verbose("install directory does not exist or invalid directory selected, %s", gConfigGeneral.game_path);
|
||||||
if (!config_find_or_browse_install_directory()) {
|
if (!config_find_or_browse_install_directory()) {
|
||||||
log_fatal("Invalid RCT2 installation path. Please correct in config.ini.");
|
utf8 path[MAX_PATH];
|
||||||
|
config_get_default_path(path);
|
||||||
|
log_fatal("Invalid RCT2 installation path. Please correct \"game_path\" in %s.", path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue