Skip to content

Commit 3a355bc

Browse files
committed
Fix treating packages as files.
1 parent 059d1ba commit 3a355bc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

druid-shell/src/platform/mac/dialog.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ pub(crate) fn get_file_dialog_path(
3939
FileDialogType::Save => msg_send![class!(NSSavePanel), savePanel],
4040
};
4141

42+
// Directories with extensions need to be treated as directories.
43+
// File packages are a macOS concept and don't translate in a cross-platform way.
44+
let () = msg_send![panel, setTreatsFilePackagesAsDirectories: YES];
45+
4246
// Set open dialog specific options
4347
// NSOpenPanel inherits from NSSavePanel and thus has more options.
4448
let mut set_type_filter = true;
@@ -49,7 +53,8 @@ pub(crate) fn get_file_dialog_path(
4953
// because other platforms like Windows have no support for it,
5054
// and expecting it to work will lead to buggy cross-platform behavior.
5155
let () = msg_send![panel, setCanChooseFiles: NO];
52-
// Because we're choosing only directories, file filters don't make sense.
56+
// Because we're choosing only directories, file filters need to be disabled.
57+
// Otherwise macOS will still allow selecting those files which match the filter.
5358
set_type_filter = false;
5459
}
5560
if options.multi_selection {

0 commit comments

Comments
 (0)