From fa0b607bf92837525c24dbebaf16fa4cf2975130 Mon Sep 17 00:00:00 2001 From: Oli Date: Wed, 4 Jan 2023 12:57:09 +0000 Subject: [PATCH] Win32 FileChooser: Enable native 'Save' directory --- modules/juce_gui_basics/native/juce_win32_FileChooser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp index 8eb19721cc..b138fa28ee 100644 --- a/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp +++ b/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp @@ -45,7 +45,9 @@ public: title (titleToUse), filtersString (filtersToUse.replaceCharacter (',', ';')), selectsDirectories ((flags & FileBrowserComponent::canSelectDirectories) != 0), - isSave ((flags & FileBrowserComponent::saveMode) != 0), + // When dealing with directories, it is not possible to 'Save' them. However, one can 'Open' a directory in order to save into it. + // If the 'saveMode' and 'canSelectDirectories' flags are both present, create an FileOpenDialog instead of an FileSaveDialog. + isSave ((flags & FileBrowserComponent::saveMode) != 0 && ! selectsDirectories), warnAboutOverwrite ((flags & FileBrowserComponent::warnAboutOverwriting) != 0), selectMultiple ((flags & FileBrowserComponent::canSelectMultipleItems) != 0) { @@ -249,7 +251,7 @@ private: JUCE_COMRESULT OnShareViolation (IFileDialog* d, IShellItem*, FDE_SHAREVIOLATION_RESPONSE*) override { return updateHwnd (d); } JUCE_COMRESULT OnOverwrite (IFileDialog* d, IShellItem*, FDE_OVERWRITE_RESPONSE*) override { return updateHwnd (d); } - /** Workaround for a bug in Vista+, OpenFileDialog will truncate the initialFile text. + /* Workaround for a bug in Vista+, OpenFileDialog will truncate the initialFile text. Moving the caret along the full length of the text and back will reveal the full string. */ void focusWorkaround()