diff --git a/atom/browser/ui/file_dialog.h b/atom/browser/ui/file_dialog.h index f65204c10e47..a8703bebf8d8 100644 --- a/atom/browser/ui/file_dialog.h +++ b/atom/browser/ui/file_dialog.h @@ -28,6 +28,7 @@ enum FileDialogProperty { FILE_DIALOG_MULTI_SELECTIONS = 1 << 2, FILE_DIALOG_CREATE_DIRECTORY = 1 << 3, FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4, + FILE_DIALOG_PROMPT_TO_CREATE = 1 << 5, }; typedef base::Callback open_dialog( default_path, title, button_label, filters, options); diff --git a/docs/api/dialog.md b/docs/api/dialog.md index 18f1fc6b0710..00a7e92ef160 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -32,9 +32,17 @@ The `dialog` module has the following methods: * `buttonLabel` String (optional) - Custom label for the confirmation button, when left empty the default label will be used. * `filters` [FileFilter[]](structures/file-filter.md) (optional) - * `properties` String[] (optional) - Contains which features the dialog should use, can - contain `openFile`, `openDirectory`, `multiSelections`, `createDirectory` - and `showHiddenFiles`. + * `properties` String[] (optional) - Contains which features the dialog should + use. The following values are supported: + * `openFile` - Allow files to be selected. + * `openDirectory` - Allow directories to be selected. + * `multiSelections` - Allow multiple paths to be selected. + * `showHiddenFiles` - Show hidden files in dialog. + * `createDirectory` _macOS_ - Allow creating new directories from dialog. + * `promptToCreate` _Windows_ - Prompt for creation if the file path entered + in the dialog does not exist. This does not actually create the file at + the path but allows non-existent paths to be returned that should be + created by the application. * `normalizeAccessKeys` Boolean (optional) - Normalize the keyboard access keys across platforms. Default is `false`. Enabling this assumes `&` is used in the button labels for the placement of the keyboard shortcut access key diff --git a/lib/browser/api/dialog.js b/lib/browser/api/dialog.js index 9e1091cf9643..85572b3b4fba 100644 --- a/lib/browser/api/dialog.js +++ b/lib/browser/api/dialog.js @@ -9,7 +9,8 @@ const fileDialogProperties = { openDirectory: 1 << 1, multiSelections: 1 << 2, createDirectory: 1 << 3, - showHiddenFiles: 1 << 4 + showHiddenFiles: 1 << 4, + promptToCreate: 1 << 5 } const messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']