mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: save dialog extensions should be deterministic (#25193)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -90,7 +90,8 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
|
||||
|
||||
// Create array to keep file types and their name.
|
||||
for (const Filter& filter : filters) {
|
||||
NSMutableSet* file_type_set = [NSMutableSet set];
|
||||
NSMutableOrderedSet* file_type_set =
|
||||
[NSMutableOrderedSet orderedSetWithCapacity:filters.size()];
|
||||
[filter_names addObject:@(filter.first.c_str())];
|
||||
for (std::string ext : filter.second) {
|
||||
// macOS is incapable of understanding multiple file extensions,
|
||||
@@ -104,7 +105,7 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
|
||||
|
||||
[file_type_set addObject:@(ext.c_str())];
|
||||
}
|
||||
[file_types_list addObject:[file_type_set allObjects]];
|
||||
[file_types_list addObject:[file_type_set array]];
|
||||
}
|
||||
|
||||
// Passing empty array to setAllowedFileTypes will cause exception.
|
||||
|
||||
Reference in New Issue
Block a user