summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Native_File_Chooser_WIN32.cxx25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/Fl_Native_File_Chooser_WIN32.cxx b/src/Fl_Native_File_Chooser_WIN32.cxx
index bc823eb1b..0376c54ac 100644
--- a/src/Fl_Native_File_Chooser_WIN32.cxx
+++ b/src/Fl_Native_File_Chooser_WIN32.cxx
@@ -376,27 +376,22 @@ int Fl_Native_File_Chooser::showfile() {
} else {
err = GetOpenFileNameW(&_ofn);
}
+ // GET EXTENDED ERROR
+ int exterr = CommDlgExtendedError();
+ // XXX: RESTORE CWD
+ if ( oldcwd ) {
+ SetCurrentDirectory(oldcwd);
+ free(oldcwd); oldcwd = 0;
+ }
+ // ERROR OR CANCEL?
if ( err == 0 ) {
- // EXTENDED ERROR CHECK
- int err = CommDlgExtendedError();
- // CANCEL?
- if ( err == 0 ) return(1); // user hit 'cancel'
- // AN ERROR OCCURRED
+ if ( exterr == 0 ) return(1); // user hit cancel
+ // Otherwise, an error occurred..
char msg[80];
sprintf(msg, "CommDlgExtendedError() code=%d", err);
errmsg(msg);
- // XXX: RESTORE CWD
- if ( oldcwd ) {
- SetCurrentDirectory(oldcwd);
- free(oldcwd); oldcwd = 0;
- }
return(-1);
}
- // XXX: RESTORE CWD
- if ( oldcwd ) {
- SetCurrentDirectory(oldcwd);
- free(oldcwd); oldcwd = 0;
- }
// PREPARE PATHNAMES FOR RETURN
switch ( _btype ) {
case BROWSE_FILE: