Browse Source

Add support for a noResolveAliases property

Samuel Attard 8 years ago
parent
commit
e45d8079b8
3 changed files with 11 additions and 7 deletions
  1. 7 6
      atom/browser/ui/file_dialog.h
  2. 2 0
      atom/browser/ui/file_dialog_mac.mm
  3. 2 1
      lib/browser/api/dialog.js

+ 7 - 6
atom/browser/ui/file_dialog.h

@@ -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(

+ 2 - 0
atom/browser/ui/file_dialog_mac.mm

@@ -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.resolvesAliases = false;
 }
 
 // Run modal dialog with parent window and return user's choice.

+ 2 - 1
lib/browser/api/dialog.js

@@ -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']