# HG changeset patch # User Matti Hamalainen # Date 1352442515 -7200 # Node ID 212d4738438dfeb8d8d4fe10fcec4019bf110235 # Parent cfc20df88401094bcdcc099dc48a0ca73ba2d225 Use the message box dialog, inform user when the path is not a directory when returning from file selector of HVSC or ROM paths. Adjust path to the "most likely" one. diff -r cfc20df88401 -r 212d4738438d src/xs_config.c --- a/src/xs_config.c Fri Nov 09 08:24:46 2012 +0200 +++ b/src/xs_config.c Fri Nov 09 08:28:35 2012 +0200 @@ -1110,10 +1110,18 @@ { (void) button; (void) user_data; + gchar *path, *result = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector)); + if (!xs_is_dir_path(result)) + { + path = xs_get_dir_path(result); + xs_messagebox("Warning", + "Selected HVSC path '%s' does not seem like a path, adjusting to '%s'.\n", + result, path); + } + else + path = result; - /* Selection was accepted! */ - gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), - gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector))); + gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), path); /* Close file selector window */ gtk_widget_destroy(xs_hvsc_selector); @@ -1150,10 +1158,18 @@ { (void) button; (void) user_data; + gchar *path, *result = gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_rom_selector)); + if (!xs_is_dir_path(result)) + { + path = xs_get_dir_path(result); + xs_messagebox("Warning", + "Selected ROM path '%s' does not seem like a path, adjusting to '%s'.\n", + result, path); + } + else + path = result; - /* Selection was accepted! */ - gtk_entry_set_text(GTK_ENTRY(LUW("cfg_rom_path")), - gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_rom_selector))); + gtk_entry_set_text(GTK_ENTRY(LUW("cfg_rom_path")), path); /* Close file selector window */ gtk_widget_destroy(xs_rom_selector);