Console: Fix directory change

On opening a scenario, console mode changed the working directory
to the app dir, instead of keeping the current wd unchanged.
Nicolas Hake 2009-07-12 22:44:23 +02:00
parent 3bdb703009
commit 8d44dc28cd
1 changed files with 2 additions and 1 deletions

View File

@ -1013,13 +1013,14 @@ BOOL C4Console::FileSelect(char *sFilename, int iSize, const char * szFilter, DW
ofn.Flags=dwFlags;
BOOL fResult;
const char *wd = GetWorkingDirectory();
if (fSave)
fResult = GetSaveFileName(&ofn);
else
fResult = GetOpenFileName(&ofn);
// Reset working directory to exe path as Windows file dialog might have changed it
SetCurrentDirectory(Config.General.ExePath);
SetCurrentDirectory(wd);
return fResult;
#elif defined(WITH_DEVELOPER_MODE)
GtkWidget* dialog = gtk_file_chooser_dialog_new(fSave ? "Save file..." : "Load file...", GTK_WINDOW(window), fSave ? GTK_FILE_CHOOSER_ACTION_SAVE : GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, fSave ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);