🍎 Add treatPackageasDirectory as an option

This commit is contained in:
Shubham 2017-07-17 21:40:57 -04:00 committed by Kevin Sawicki
parent 80e35b6682
commit b25a1d10a2
4 changed files with 7 additions and 2 deletions

View file

@ -30,6 +30,7 @@ enum FileDialogProperty {
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
FILE_DIALOG_PROMPT_TO_CREATE = 1 << 5,
FILE_DIALOG_NO_RESOLVE_ALIASES = 1 << 6,
FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY = 1 << 7,
};
typedef base::Callback<void(

View file

@ -93,7 +93,6 @@ void SetupDialog(NSSavePanel* dialog,
void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
[dialog setCanChooseFiles:(properties & FILE_DIALOG_OPEN_FILE)];
[dialog setTreatsFilePackagesAsDirectories:YES];
if (properties & FILE_DIALOG_OPEN_DIRECTORY)
[dialog setCanChooseDirectories:YES];
if (properties & FILE_DIALOG_CREATE_DIRECTORY)
@ -104,6 +103,8 @@ void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
[dialog setShowsHiddenFiles:YES];
if (properties & FILE_DIALOG_NO_RESOLVE_ALIASES)
[dialog setResolvesAliases:NO];
if (properties & FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY)
[dialog setTreatsFilePackagesAsDirectories:YES];
}
// Run modal dialog with parent window and return user's choice.

View file

@ -46,6 +46,8 @@ The `dialog` module has the following methods:
* `noResolveAliases` - Disable the automatic alias (symlink) path
resolution. Selected aliases will now return the alias path instead of
their target path. _macOS_
* `treatPackageAsDirectory` - Treats file package(for example Electron.app)
as a directory instead of file
* `message` String (optional) _macOS_ - Message to display above input
boxes.
* `callback` Function (optional)

View file

@ -11,7 +11,8 @@ const fileDialogProperties = {
createDirectory: 1 << 3,
showHiddenFiles: 1 << 4,
promptToCreate: 1 << 5,
noResolveAliases: 1 << 6
noResolveAliases: 1 << 6,
treatPackageAsDirectory: 1 << 7
}
const messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']