X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gtk%2Fxboard.c;h=ef35f2a0794a769c18c2d213d885de27544c052e;hb=54def5260846784eea25fad94a8ef0c34dcf807b;hp=8a2b8871371b68e5759765479aa8117f3eb86ff5;hpb=2392a87503272e7ae1dcaa6aa8628955dc5493d1;p=xboard.git diff --git a/gtk/xboard.c b/gtk/xboard.c index 8a2b887..ef35f2a 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -2317,6 +2317,12 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp char fileext[10] = ""; char *result = NULL; char *cp; + char curDir[MSG_SIZ]; + + if(def && *def && def[strlen(def)-1] == '/') { + getcwd(curDir, MSG_SIZ); + chdir(def); + } /* make a copy of the filter string, so that strtok can work with it*/ cp = strdup(filter); @@ -2396,6 +2402,8 @@ void FileNamePopUpWrapper(label, def, filter, proc, pathFlag, openMode, name, fp gtk_widget_destroy (dialog); ModeHighlight(); + if(def && *def && def[strlen(def)-1] == '/') chdir(curDir); + free(cp); return;