]> khamidou — GitHub mirrors - electron.git/commitdiff
Update dialog.md with info about filter extensions
authorEran Tiktin <etiktin@users.noreply.github.com>
Fri, 21 Aug 2015 18:18:37 +0000 (21:18 +0300)
committerEran Tiktin <etiktin@users.noreply.github.com>
Fri, 21 Aug 2015 18:18:37 +0000 (21:18 +0300)
There was some confusion about the correct way to add an `All Files` filter (see #2525), so I added it to the example.
Also added a short note about the extension syntax.

This is related to PR #2547.

docs/api/dialog.md

index d9336c0c8a3a343d9fd02b938aadbab8f182d645..22dd58db2d142c86349cbfd1e46d99c84e1b5eb6 100644 (file)
@@ -36,10 +36,12 @@ selected, an example is:
   filters: [
     { name: 'Images', extensions: ['jpg', 'png', 'gif'] },
     { name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] },
-    { name: 'Custom File Type', extensions: ['as'] }
+    { name: 'Custom File Type', extensions: ['as'] },
+    { name: 'All Files', extensions: ['*'] }
   ]
 }
 ```
+The `extensions` array should contain extensions without wildcards or dots (e.g. `'png'` is good, `'.png'` and `'*.png'` are bad). To show all files, use the `'*'` wildcard (no other wildcard is supported).
 
 If a `callback` is passed, the API call would be asynchronous and the result
 would be passed via `callback(filenames)`