From 8a003fbe9901aff614bc67c088adcfca22ebbaea Mon Sep 17 00:00:00 2001 From: GoaLitiuM Date: Fri, 9 Jul 2021 20:02:57 +0300 Subject: [PATCH] Prevent file dialogs from changing the working directory --- Source/Engine/Platform/Windows/WindowsFileSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/Platform/Windows/WindowsFileSystem.cpp b/Source/Engine/Platform/Windows/WindowsFileSystem.cpp index 6cf467976..463715b2d 100644 --- a/Source/Engine/Platform/Windows/WindowsFileSystem.cpp +++ b/Source/Engine/Platform/Windows/WindowsFileSystem.cpp @@ -213,7 +213,7 @@ bool WindowsFileSystem::ShowOpenFileDialog(Window* parentWindow, const StringVie of.lpstrFilter = filter.HasChars() ? filter.Get() : nullptr; of.lpstrFile = fileNamesBuffer.Get(); of.nMaxFile = maxFilenamesSize; - of.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ENABLESIZING; + of.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_NOCHANGEDIR; of.lpstrTitle = title.HasChars() ? title.Get() : nullptr; of.lpstrInitialDir = initialDirectory.HasChars() ? initialDirectory.Get() : nullptr; if (parentWindow) @@ -260,7 +260,7 @@ bool WindowsFileSystem::ShowSaveFileDialog(Window* parentWindow, const StringVie of.lpstrFilter = filter.HasChars() ? filter.Get() : nullptr; of.lpstrFile = fileNamesBuffer.Get(); of.nMaxFile = maxFilenamesSize; - of.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT; + of.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR; of.lpstrTitle = title.HasChars() ? title.Get() : nullptr; of.lpstrInitialDir = initialDirectory.HasChars() ? initialDirectory.Get() : nullptr; if (parentWindow)