From a067113d52078eee610556f371c1025fbb25c62b Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 6 Mar 2016 12:48:28 +0000 Subject: [PATCH] Loop the check for data path until valid address given. This is to prevent people from selecting the wrong address and then wondering why the game doesn't work. Related to #1648. --- src/config.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/config.c b/src/config.c index 6742cfd6ae..e49927276a 100644 --- a/src/config.c +++ b/src/config.c @@ -907,13 +907,22 @@ bool config_find_or_browse_install_directory() gConfigGeneral.game_path = malloc(strlen(path) + 1); safe_strcpy(gConfigGeneral.game_path, path, MAX_PATH); } else { - platform_show_messagebox("Unable to find RCT2 installation directory. Please select the directory where you installed RCT2!"); - installPath = platform_open_directory_browser("Please select your RCT2 directory"); - if (installPath == NULL) - return false; + while (1) { + platform_show_messagebox("Unable to find RCT2 installation directory. Please select the directory where you installed RCT2!"); + installPath = platform_open_directory_browser("Please select your RCT2 directory"); + if (installPath == NULL) + return false; - SafeFree(gConfigGeneral.game_path); - gConfigGeneral.game_path = installPath; + SafeFree(gConfigGeneral.game_path); + gConfigGeneral.game_path = installPath; + + if (platform_original_game_data_exists(installPath)) + return true; + + utf8 message[MAX_PATH] = { 0 }; + sprintf(message, "Could not find %sData%cg1.dat at this path", installPath, platform_get_path_separator()); + platform_show_messagebox(message); + } } return true;