Dialog for selecting files or directories in the filesystem.
    public class FileDialog : ConfirmationDialog

FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks.

Inheritance Chain


    public FileDialog()


    "dir_selected" (String dir)

Event emitted when the user selects a directory.

    "file_selected" (String path)

Event emitted when the user selects a file (double clicks it or presses the OK button).

    "files_selected" (PoolStringArray paths)

Event emitted when the user selects multiple files.


    public AccessEnum Access { get; set; }

The file system access scope. See enum Access constants.

    public string CurrentDir { get; set; }

The current working directory of the file dialog.

    public string CurrentFile { get; set; }

The currently selected file of the file dialog.

    public string CurrentPath { get; set; }

The currently selected file path of the file dialog.

    public string[] Filters { get; set; }

Set file type filters. This example shows only .png and .gd files set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GD Script"])).

    public ModeEnum Mode { get; set; }

Set dialog to open or save mode, changes selection behavior. See enum Mode constants.

    public bool ModeOverridesTitle { get; set; }

If true, changing the Mode property will set the window title accordingly (e.g. setting mode to MODE_OPEN_FILE will change the window title to “Open a File”).

    public bool ShowHiddenFiles { get; set; }

If true, the dialog will show hidden files.


    public void AddFilter(string filter)

Add a custom filter. Example: add_filter("*.png ; PNG Images")

    public void ClearFilters()

Clear all the added filters in the dialog.

    public void DeselectItems()

Clear currently selected items in the dialog.

    public AccessEnum GetAccess()

Getter for Access

    public string GetCurrentDir()

Getter for CurrentDir

    public string GetCurrentFile()

Getter for CurrentFile

    public string GetCurrentPath()

Getter for CurrentPath

    public string[] GetFilters()

Getter for Filters

    public LineEdit GetLineEdit()

Returns the LineEdit for the selected file.

    public ModeEnum GetMode()

Getter for Mode

    public VBoxContainer GetVbox()

Return the vertical box container of the dialog, custom controls can be added to it.

    public void Invalidate()

Invalidate and update the current dialog content list.

    public bool IsModeOverridingTitle()

Getter for ModeOverridesTitle

    public bool IsShowingHiddenFiles()

Getter for ShowHiddenFiles

    public void SetAccess(AccessEnum access)

Setter for Access

    public void SetCurrentDir(string dir)

Setter for CurrentDir

    public void SetCurrentFile(string file)

Setter for CurrentFile

    public void SetCurrentPath(string path)

Setter for CurrentPath

    public void SetFilters(string[] filters)

Setter for Filters

    public void SetMode(ModeEnum mode)

Setter for Mode

    public void SetModeOverridesTitle(bool @override)

Setter for ModeOverridesTitle

    public void SetShowHiddenFiles(bool show)

Setter for ShowHiddenFiles

Inner Types


Name Value Description
Resources 0 The dialog allows the selection of file and directory.
Userdata 1 The dialog allows access files under [Resource] path(res://) .
Filesystem 2 The dialog allows access files in whole file system.


Name Value Description
OpenFile 0 The dialog allows the selection of one, and only one file.
OpenFiles 1 The dialog allows the selection of multiple files.
OpenDir 2 The dialog functions as a folder selector, disallowing the selection of any file.
OpenAny 3 The dialog allows the selection of a file or a directory.
SaveFile 4 The dialog will warn when a file exists.