@@ -183,7 +183,18 @@ interface size {
183
183
* polygon array and then assign it to {@link MapObject.polygon}.
184
184
*/
185
185
type Polygon = point [ ] ;
186
-
186
+ /**
187
+ * A string used to show only certain types of files when prompting the user to select a file path.
188
+ *
189
+ * Used in {@link FileEdit} and in {@link tiled.promptOpenFile} and related methods.
190
+ * The filter is given in a format like `"Images (*.png *.xpm *.jpg)"`.
191
+ *
192
+ * If you want multiple filters, separate them with ';;', for example:
193
+ * ```
194
+ * "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
195
+ * ```
196
+ */
197
+ type FileFilter = string ;
187
198
/**
188
199
* The value of a property of type 'object', which refers to a
189
200
* {@link MapObject} by its ID.
@@ -3924,6 +3935,42 @@ declare namespace tiled {
3924
3935
*/
3925
3936
export function prompt ( label : string , text ?: string , title ?: string ) : string ;
3926
3937
3938
+ /**
3939
+ * Shows a dialog which asks the user to choose an existing directory.
3940
+ * Optionally override the starting directory of the dialog or its title.
3941
+ *
3942
+ * Returns the absolute path of the chosen directory, or an empty string if the user cancels the dialog.
3943
+ */
3944
+ export function promptForDirectory ( defaultDir ?: string , title ?: string ) : string ;
3945
+
3946
+ /**
3947
+ * Shows a dialog which asks the user to choose one or more existing files.
3948
+ * Optionally override the starting directory of the dialog or its title.
3949
+ * You can also restrict to only certain file types by specifying {@link FileFilter|filters}.
3950
+ *
3951
+ * Returns an array of the absolute paths of the chosen files, or an empty array if the user cancels the dialog.
3952
+ */
3953
+ export function promptOpenMultipleFiles ( defaultDir ?: string , filters ?: string , title ?: string ) : string [ ] ;
3954
+
3955
+ /**
3956
+ * Shows a dialog which asks the user to choose an existing file.
3957
+ * Optionally override the starting directory of the dialog or its title.
3958
+ * You can also restrict to only certain file types by specifying {@link FileFilter|filters}.
3959
+ *
3960
+ * Returns the absolute path of the chosen file, or an empty string if the user cancels the dialog.
3961
+ */
3962
+ export function promptOpenFile ( defaultDir ?: string , filters ?: string , title ?: string ) : string ;
3963
+
3964
+ /**
3965
+ * Shows a dialog which asks the user to choose a destination for saving a file.
3966
+ * If the user chooses a file path which already exists, they will be asked to confirm that they want to overwrite the file.
3967
+ * Optionally override the starting directory of the dialog or its title.
3968
+ * You can also restrict to only certain file types by specifying {@link FileFilter|filters}.
3969
+ *
3970
+ * Returns the absolute path of the chosen file, or an empty string if the user cancels the dialog.
3971
+ */
3972
+ export function promptSaveFile ( defaultDir ?: string , filters ?: string , title ?: string ) : string ;
3973
+
3927
3974
/**
3928
3975
* Outputs the given text in the Console window as regular text.
3929
3976
*/
0 commit comments