From c64afb86268815e6dce20e6da3a4bfb96235be11 Mon Sep 17 00:00:00 2001 From: Sven Eberhardt Date: Tue, 19 Mar 2013 00:22:17 +0100 Subject: [PATCH] Win32: Fix broken "Save as..." dialog in editor mode when engine is started with forward slashes in scenario path --- src/editor/C4ConsoleWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/C4ConsoleWin32.cpp b/src/editor/C4ConsoleWin32.cpp index 4efe61774..23f09b0e7 100644 --- a/src/editor/C4ConsoleWin32.cpp +++ b/src/editor/C4ConsoleWin32.cpp @@ -758,6 +758,7 @@ bool C4ConsoleGUI::FileSelect(StdStrBuf *sFilename, const char * szFilter, DWORD { enum { ArbitraryMaximumLength = 4096 }; wchar_t buffer[ArbitraryMaximumLength]; + sFilename->ReplaceChar('/', '\\'); // GetSaveFileNameW has trouble with forward slashes wcsncpy(buffer, sFilename->GetWideChar(), ArbitraryMaximumLength - 1); buffer[ArbitraryMaximumLength - 1] = 0; OPENFILENAMEW ofn; @@ -785,7 +786,6 @@ bool C4ConsoleGUI::FileSelect(StdStrBuf *sFilename, const char * szFilter, DWORD fResult = !!GetSaveFileNameW(&ofn); else fResult = !!GetOpenFileNameW(&ofn); - // Reset working directory to exe path as Windows file dialog might have changed it SetCurrentDirectoryW(wd); delete[] wd;