mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 22:50:59 +08:00
Show extension by default (#1228)
This commit is contained in:
parent
106ff03f2e
commit
97b24a51a1
@ -563,6 +563,9 @@
|
|||||||
// Create the dialog
|
// Create the dialog
|
||||||
NSSavePanel *dialog = [NSSavePanel savePanel];
|
NSSavePanel *dialog = [NSSavePanel savePanel];
|
||||||
|
|
||||||
|
// Do not hide extension
|
||||||
|
[dialog setExtensionHidden:false];
|
||||||
|
|
||||||
// Valid but appears to do nothing.... :/
|
// Valid but appears to do nothing.... :/
|
||||||
if( title != nil ) {
|
if( title != nil ) {
|
||||||
[dialog setTitle:title];
|
[dialog setTitle:title];
|
||||||
@ -573,7 +576,25 @@
|
|||||||
filters = [filters stringByReplacingOccurrencesOfString:@"*." withString:@""];
|
filters = [filters stringByReplacingOccurrencesOfString:@"*." withString:@""];
|
||||||
filters = [filters stringByReplacingOccurrencesOfString:@" " withString:@""];
|
filters = [filters stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||||
NSArray *filterList = [filters componentsSeparatedByString:@";"];
|
NSArray *filterList = [filters componentsSeparatedByString:@";"];
|
||||||
|
#ifdef USE_NEW_FILTERS
|
||||||
|
NSMutableArray *contentTypes = [[NSMutableArray new] autorelease];
|
||||||
|
for (NSString *filter in filterList) {
|
||||||
|
if (@available(macOS 11.0, *)) {
|
||||||
|
UTType *t = [UTType typeWithFilenameExtension:filter];
|
||||||
|
[contentTypes addObject:t];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( contentTypes.count == 0) {
|
||||||
|
[dialog setAllowsOtherFileTypes:true];
|
||||||
|
} else {
|
||||||
|
if (@available(macOS 11.0, *)) {
|
||||||
|
[dialog setAllowedContentTypes:contentTypes];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
[dialog setAllowedFileTypes:filterList];
|
[dialog setAllowedFileTypes:filterList];
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
[dialog setAllowsOtherFileTypes:true];
|
[dialog setAllowsOtherFileTypes:true];
|
||||||
}
|
}
|
||||||
@ -589,6 +610,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup Options
|
// Setup Options
|
||||||
|
[dialog setCanSelectHiddenExtension:true];
|
||||||
|
// dialog.isExtensionHidden = false;
|
||||||
[dialog setCanCreateDirectories: canCreateDirectories];
|
[dialog setCanCreateDirectories: canCreateDirectories];
|
||||||
[dialog setTreatsFilePackagesAsDirectories: treatPackagesAsDirectories];
|
[dialog setTreatsFilePackagesAsDirectories: treatPackagesAsDirectories];
|
||||||
[dialog setShowsHiddenFiles: showHiddenFiles];
|
[dialog setShowsHiddenFiles: showHiddenFiles];
|
||||||
|
Loading…
Reference in New Issue
Block a user