Merge pull request #8617 from electron/resolves-aliases-nsopen
Add resolvesAliases option to openDialog
This commit is contained in:
commit
8c2cf03f37
4 changed files with 14 additions and 7 deletions
|
@ -23,12 +23,13 @@ typedef std::pair<std::string, std::vector<std::string> > Filter;
|
|||
typedef std::vector<Filter> Filters;
|
||||
|
||||
enum FileDialogProperty {
|
||||
FILE_DIALOG_OPEN_FILE = 1 << 0,
|
||||
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
|
||||
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,
|
||||
FILE_DIALOG_OPEN_FILE = 1 << 0,
|
||||
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
|
||||
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,
|
||||
FILE_DIALOG_NO_RESOLVE_ALIASES = 1 << 6,
|
||||
};
|
||||
|
||||
typedef base::Callback<void(
|
||||
|
|
|
@ -93,6 +93,8 @@ void SetupDialogForProperties(NSOpenPanel* dialog, int properties) {
|
|||
[dialog setAllowsMultipleSelection:YES];
|
||||
if (properties & FILE_DIALOG_SHOW_HIDDEN_FILES)
|
||||
[dialog setShowsHiddenFiles:YES];
|
||||
if (properties & FILE_DIALOG_NO_RESOLVE_ALIASES)
|
||||
[dialog setResolvesAliases:NO];
|
||||
}
|
||||
|
||||
// Run modal dialog with parent window and return user's choice.
|
||||
|
|
|
@ -43,6 +43,9 @@ The `dialog` module has the following methods:
|
|||
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.
|
||||
* `noResolveAliases` _macOS_ - Disable the automatic alias (symlink) path
|
||||
resolution. Selected aliases will now return the alias path instead of
|
||||
their target path.
|
||||
* `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
|
||||
|
|
|
@ -10,7 +10,8 @@ const fileDialogProperties = {
|
|||
multiSelections: 1 << 2,
|
||||
createDirectory: 1 << 3,
|
||||
showHiddenFiles: 1 << 4,
|
||||
promptToCreate: 1 << 5
|
||||
promptToCreate: 1 << 5,
|
||||
noResolveAliases: 1 << 6
|
||||
}
|
||||
|
||||
const messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']
|
||||
|
|
Loading…
Reference in a new issue