You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added multiple file/folder selection support (closed#10)
Note that the Scripting API has also changed slightly with this new feature. The OnSuccess callback now returns string[] instead of string and dialog functions now take an allowMultiSelection parameter (false by default)
Copy file name to clipboardExpand all lines: .github/README.md
+31-24Lines changed: 31 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,8 @@
16
16
- Simple user interface
17
17
- Draggable and resizable
18
18
- Ability to choose folders instead of files
19
-
- Supports runtime permissions on Android M+
19
+
- Supports selecting multiple files/folders
20
+
- Supports runtime permissions on Android M+ and *Storage Access Framework* on Android Q+
20
21
- Optimized using a recycled list view (makes *Instantiate* calls sparingly)
21
22
22
23
**NOTE:** Universal Windows Platform (UWP) is not supported!
@@ -41,28 +42,28 @@ There are 5 ways to install this plugin:
41
42
42
43
First, add `using SimpleFileBrowser;` to your script.
43
44
44
-
The file browser can be shown either as a **save dialog** or a **load dialog**. In load mode, the returned path always leads to an existing file or folder. In save mode, the returned path can point to a non-existing file, as well. You can use the following functions to show the file browser:
45
+
The file browser can be shown either as a **save dialog** or a **load dialog**. In load mode, the returned path(s) always lead to existing files or folders. In save mode, the returned path(s) can point to non-existing files, as well. You can use the following functions to show the file browser:
There can only be one dialog active at a time. These functions will return *true* if the dialog is shown successfully (if no other dialog is active), *false* otherwise. You can query the **FileBrowser.IsOpen** property to see if there is an active dialog at the moment.
55
56
56
-
If user presses the *Cancel* button, **onCancel** callback is called. Otherwise, **onSuccess** callback is called with the path of the selected file/folder as parameter. When **folderMode** is set to *true*, the file browser will show only folders and the user will pick a folder instead of a file.
57
+
If user presses the *Cancel* button, **onCancel** callback is called. Otherwise, **onSuccess** callback is called with the paths of the selected files/folders as parameter. When **folderMode** is set to *true*, the file browser will show only folders and the user will pick folders instead of files. Setting **allowMultiSelection** to *true* will allow picking multiple files/folders.
57
58
58
59
There are also coroutine variants of these functions that will yield while the dialog is active:
After the dialog is closed, you can check the **FileBrowser.Success** property to see whether the user selected a file/folder or cancelled the operation and if FileBrowser.Success was set to *true*, you can use the **FileBrowser.Result** property to get the path of the selected file/folder.
66
+
After the dialog is closed, you can check the **FileBrowser.Success** property to see whether the user has selected some files/folders or cancelled the operation and if FileBrowser.Success is set to *true*, you can use the **FileBrowser.Result** property to get the paths of the selected files/folders.
66
67
67
68
You can force close an open dialog using the following function:
68
69
@@ -86,7 +87,7 @@ By default, the file browser doesn't show files with *.lnk* or *.tmp* extensions
0 commit comments