fix: save dialog extensions should be deterministic (#25164)
This commit is contained in:
parent
6cc960f214
commit
c5320b3951
1 changed files with 3 additions and 2 deletions
|
@ -90,7 +90,8 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
|
||||||
|
|
||||||
// Create array to keep file types and their name.
|
// Create array to keep file types and their name.
|
||||||
for (const Filter& filter : filters) {
|
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())];
|
[filter_names addObject:@(filter.first.c_str())];
|
||||||
for (std::string ext : filter.second) {
|
for (std::string ext : filter.second) {
|
||||||
// macOS is incapable of understanding multiple file extensions,
|
// 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_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.
|
// Passing empty array to setAllowedFileTypes will cause exception.
|
||||||
|
|
Loading…
Reference in a new issue