From 3be36521b4e01c9b64c4012ffa7f97f15a60fd48 Mon Sep 17 00:00:00 2001 From: "SND\\edgbla_cp" Date: Tue, 31 Jul 2012 20:30:59 +0000 Subject: Patch 12651 (dokuganryu); git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@79276 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- gui/Gtk2Gui.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/Gtk2Gui.c b/gui/Gtk2Gui.c index 2f853df0..ac8eabcc 100644 --- a/gui/Gtk2Gui.c +++ b/gui/Gtk2Gui.c @@ -606,11 +606,25 @@ static gchar *Open_Iso_Proc() { if (gtk_dialog_run(GTK_DIALOG(chooser)) == GTK_RESPONSE_OK) { gchar *path = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(chooser)); - strcpy(current_folder, path); - g_free(path); + + /* Workaround: + for some reasons gtk_file_chooser_get_current_folder return NULL + if a file is selected from "Recently Used" or "Searsh"*/ + if(path != NULL) { + strcpy(current_folder, path); + g_free(path); + } + GSList * l = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER (chooser)); if(l) { filename = l->data; + + /* if the file was selected from "Recently Used" or "Searsh" + we need to extract the path from the filename to set it to current_folder*/ + if(path == NULL) { + strncpy(current_folder, filename, strrchr(filename, '/') - filename); + } + /* free useless data */ GSList * ll = l; while(l->next) { -- cgit v1.2.3