mac: Add showHiddenFiles property for showOpenDialog

This commit is contained in:
Cheng Zhao 2016-07-11 13:30:18 +09:00
parent 33e8d5e0aa
commit f08ac07737
3 changed files with 10 additions and 6 deletions

View file

@ -27,6 +27,7 @@ enum FileDialogProperty {
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1, FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2, FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3, FILE_DIALOG_CREATE_DIRECTORY = 1 << 3,
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
}; };
typedef base::Callback<void( typedef base::Callback<void(

View file

@ -86,6 +86,8 @@ void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
[dialog setCanCreateDirectories:YES]; [dialog setCanCreateDirectories:YES];
if (properties & FILE_DIALOG_MULTI_SELECTIONS) if (properties & FILE_DIALOG_MULTI_SELECTIONS)
[dialog setAllowsMultipleSelection:YES]; [dialog setAllowsMultipleSelection:YES];
if (properties & FILE_DIALOG_SHOW_HIDDEN_FILES)
[dialog setShowsHiddenFiles:YES];
} }
// Run modal dialog with parent window and return user's choice. // Run modal dialog with parent window and return user's choice.

View file

@ -6,11 +6,12 @@ const v8Util = process.atomBinding('v8_util')
var includes = [].includes var includes = [].includes
var fileDialogProperties = { const fileDialogProperties = {
openFile: 1 << 0, openFile: 1 << 0,
openDirectory: 1 << 1, openDirectory: 1 << 1,
multiSelections: 1 << 2, multiSelections: 1 << 2,
createDirectory: 1 << 3 createDirectory: 1 << 3,
showHiddenFiles: 1 << 4
} }
var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'] var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']