Skip to content

Commit f200a02

Browse files
committed
System File Chooser: Windows: don't allow selecting non-filesystem nodes (e.g. "This PC") in "Select Folder" dialog (issue #1126)
1 parent b377a24 commit f200a02

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ FlatLaf Change Log
99
shown. (issue #1100)
1010
- Windows: Fixed too small message dialogs (shown from approve callback).
1111
(issue #1119)
12+
- Windows: Don't allow selecting non-filesystem nodes (e.g. "This PC") in
13+
"Select Folder" dialog. (issue #1126)
1214
- macOS: Fixed missing close/iconify/maximize buttons on inactive window, if
1315
system appearance is dark, but application appearance is light. (issue #1032)
1416
- Linux with JetBrains Runtime: Fixed mouse "jumping" to other position when

flatlaf-core/src/main/java/com/formdev/flatlaf/util/SystemFileChooser.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,12 @@ String[] showSystemDialog( Window owner, SystemFileChooser fc ) {
996996
// options
997997
int optionsBlocked = FlatNativeWindowsLibrary.FOS_PICKFOLDERS
998998
| FlatNativeWindowsLibrary.FOS_ALLOWMULTISELECT
999-
| FlatNativeWindowsLibrary.FOS_FORCESHOWHIDDEN;
1000-
int optionsSet = fc.getPlatformOptions( WINDOWS_OPTIONS_SET, optionsBlocked );
999+
| FlatNativeWindowsLibrary.FOS_FORCESHOWHIDDEN
1000+
| FlatNativeWindowsLibrary.FOS_FORCEFILESYSTEM
1001+
| FlatNativeWindowsLibrary.FOS_NOCHANGEDIR;
1002+
int optionsSet = fc.getPlatformOptions( WINDOWS_OPTIONS_SET, optionsBlocked )
1003+
| FlatNativeWindowsLibrary.FOS_FORCEFILESYSTEM // don't allow choosing "This PC" in "Select Folder" dialog
1004+
| FlatNativeWindowsLibrary.FOS_NOCHANGEDIR;
10011005
int optionsClear = fc.getPlatformOptions( WINDOWS_OPTIONS_CLEAR, optionsBlocked );
10021006
if( (optionsClear & FlatNativeWindowsLibrary.FOS_OVERWRITEPROMPT) == 0 )
10031007
optionsSet |= FlatNativeWindowsLibrary.FOS_OVERWRITEPROMPT;

0 commit comments

Comments
 (0)