FileSystemDock in Godot – Complete Guide

Managing files and folders is an integral part of game development. When working on projects, especially within powerful editors like Godot, an efficient way to navigate and manage these resources is key to a streamlined workflow. In this tutorial, we will explore the FileSystemDock class in Godot 4, a crucial component for handling project files directly within the editor environment.

What is FileSystemDock?

FileSystemDock is a Godot editor component specialized in managing the files and folders within your project. If you’re familiar with file explorers on desktop operating systems, you can think of FileSystemDock as Godot’s built-in version for your game projects. It’s a non-instantiable class that operates within EditorPlugins and can be accessed through the EditorInterface API.

What is FileSystemDock Used For?

The primary purpose of FileSystemDock is to provide developers with a seamless interface for navigating through project files, moving resources around, and listening for important file-system related events. It offers developers the functionality to programmatically navigate to specific paths, add or remove resource tooltip plugins, and hook onto a variety of signals that are emitted when files or folders are added, removed, or altered in any way.

Why Should I Learn About FileSystemDock?

Understanding and utilizing the FileSystemDock is essential for Godot developers looking to:

– Organize and manage game assets more effectively.
– Automate parts of the asset pipeline.
– Extend the Godot Editor with custom plugins that require file system interactions.
React to changes in the project’s file structure without leaving the editor’s environment.

By learning how FileSystemDock works and how to harness its capabilities, you’re unlocking more efficient ways to handle the backbone of your game—the resources and assets. Whether you are a beginner setting foot in the Godot landscape or an experienced developer honing your skills, mastering FileSystemDock will elevate your game development process.

CTA Small Image

Accessing the FileSystemDock in a Plugin

Let’s begin by accessing the FileSystemDock from a custom editor plugin. This will form our base for subsequent examples. First, ensure you’ve enabled the “Editor Development” setting in Project Settings to use the EditorScript and EditorPlugin APIs.

extends EditorPlugin

var fs_dock

func _enter_tree():
    fs_dock = get_editor_interface().get_filesystem_dock()

Here, we’re extending `EditorPlugin` and overriding the `_enter_tree` method to assign our FileSystemDock instance upon plugin activation.

Reacting to File and Folder Events

FileSystemDock emits various signals when files and folders are manipulated. The following example demonstrates how to respond to a file being selected in the FileSystemDock.

extends EditorPlugin

func _enter_tree():
    var fs_dock = get_editor_interface().get_filesystem_dock()
    fs_dock.connect("file_selected", self, "_on_FileSystemDock_file_selected")

func _on_FileSystemDock_file_selected(file):
    print("File selected: " + file)

The `_on_FileSystemDock_file_selected` method will be called whenever a file is selected, and the file’s path is printed to the console.

Navigating to a Specific Path

If you need to programmatically navigate to a specific resource or folder within the editor, you can use the `navigate_to_path` method:

func open_scene_folder():
    var fs_dock = get_editor_interface().get_filesystem_dock()

By calling the `open_scene_folder()` method, the FileSystemDock will highlight and reveal the folder containing your scenes.

Adding a Resource Tooltip

You may wish to add custom tooltips for resources in the FileSystemDock. Here’s how you can implement a ResourceTooltipPlugin and add it:

class_name MyResourceTooltipPlugin extends ResourceTooltipPlugin

func _can_handle(p_data_item):
    return p_data_item.get_file_type() == "MyCustomResource"

func _get_tooltip(p_data_item):
    return "This is a custom resource tooltip"

func _enter_tree():
    var fs_dock = get_editor_interface().get_filesystem_dock()

In this snippet, we define a custom `ResourceTooltipPlugin` and override its methods to provide context-sensitive tooltips for our custom resource type.

Stay tuned for the next part of this tutorial, where we will dive into more advanced examples and showcase additional ways to harness the power of Godot’s FileSystemDock for game development.Extending the capabilities of our FileSystemDock further, we can incorporate functionality to remove a specific resource tooltip plugin, listen for when the directory is changed, or even capture when a file is going to be moved.

Removing a Resource Tooltip Plugin

To remove a tooltip plugin from the FileSystemDock, use the `remove_resource_tooltip_plugin` method:

var my_tooltip_plugin =

func remove_my_tooltip():
    var fs_dock = get_editor_interface().get_filesystem_dock()

This would remove our previously added `MyResourceTooltipPlugin`, ceasing the display of the custom tooltips.

Listening to Directory Changes

To keep track of the current directory within the FileSystemDock, we can connect to the `filesystem_dock_folder_changed` signal:

func _enter_tree():
    var fs_dock = get_editor_interface().get_filesystem_dock()
    fs_dock.connect("filesystem_dock_folder_changed", self, "_on_fs_dock_folder_changed")

func _on_fs_dock_folder_changed(new_dir):
    print("The current directory is now: " + new_dir)

Whenever the current directory changes in the FileSystemDock, our connected method will print the updated directory.

Capturing When a File Will Be Moved

The FileSystemDock emits a signal before a file or a folder is moved which we can capture to perform actions or validations:

func _enter_tree():
    var fs_dock = get_editor_interface().get_filesystem_dock()
    fs_dock.connect("files_moving", self, "_on_files_moving")

func _on_files_moving(old_file, new_file):
    print("Moving file from " + old_file + " to " + new_file)

This code showcases how to print a message whenever a move operation is initiated in the FileSystemDock.

Refreshing the FileSystemDock

There may be scenarios where you want to programmatically trigger a refresh of the FileSystemDock. You can do that with the `update_file_list` method:

func refresh_fs_dock():
    var fs_dock = get_editor_interface().get_filesystem_dock()

This will cause the FileSystemDock to re-scan the project directory and update its display, which is especially useful after programmatically altering files or folders.

Customizing FileSystemDock Behaviour

The potential customization doesn’t end here. You can also implement an `EditorFileSystem` plugin to intercept and modify the handling of the file system within Godot editor:

class_name CustomEditorFileSystem extends EditorFileSystem

func _update_file(...):
    # Override to change how file updates are handled

func _filesystem_changed():
    # Implement your custom logic to react to file system changes

Here we’ve declared a class extending `EditorFileSystem`, which could override methods to customize the behavior related to file system events.

By understanding these examples and expanding upon them, you can create a more personalized and efficient working environment within the Godot editor. As you can see, the FileSystemDock is a powerful tool that goes beyond basic file management—it can become an essential part of creating an agile and adaptable development workflow for your games.

With these capabilities at your fingertips, we hope you’re excited to explore the full potential of Godot’s FileSystemDock and make it an integral part of your game development journey. Dive into the Godot editor and start tinkering with FileSystemDock to see how it can enhance your creative process!Continuing our exploration of the FileSystemDock’s capabilities, we’ll delve into some additional functionalities which include searching for files, renaming resources, deleting files, and extending the built-in functionality using Godot’s scripting capabilities.

Searching for Files Programmatically

The FileSystemDock provides a way to programmatically search for files. Here’s an example of how to implement a search feature within a plugin:

func search_for_files(search_term):
    var fs_dock = get_editor_interface().get_filesystem_dock()

By calling `search_for_files` with a string, we can initiate a search within the FileSystemDock for that particular term.

Renaming Resources

Renaming resources programmatically can be a huge time-saver. Here’s an example of how to do that:

func rename_resource(old_path, new_name):
    var fs = get_editor_interface().get_resource_filesystem()
    fs.rename(old_path, new_name)

With this function, you can provide the old path and the new desired name to rename a file or folder.

Deleting Files Using the FileSystemDock

Occasionally, you might need to delete files directly from your plugin. This example demonstrates how that can be achieved:

func delete_file(file_path):
    var fs_dock = get_editor_interface().get_filesystem_dock()

By calling `delete_file` with a file path, you can remove the specified file from the project.

Duplicating Resources

Duplicating assets can often be needed during the development process. Here’s how to duplicate a resource in Godot:

func duplicate_resource(source_path, dest_path):
    var fs = get_editor_interface().get_resource_filesystem()
    fs.duplicate(source_path, dest_path)

Upon execution, the function duplicates the resource at `source_path` to the `dest_path`.

Customizing the Context Menu in FileSystemDock

To further tailor the FileSystemDock to your needs, you might want to add custom options to its context menu. Here’s how:

func _enter_tree():
    add_control_to_container(CONTAINER_FILESYSTEM_DOCK, my_custom_button)

func _exit_tree():
    remove_control_from_container(CONTAINER_FILESYSTEM_DOCK, my_custom_button)

var my_custom_button =

func _ready():
    my_custom_button.text = "My Button"
    my_custom_button.connect("pressed", self, "_on_custom_button_pressed")

func _on_custom_button_pressed():
    # Custom logic for when the button is pressed

This code snippet demonstrates adding a custom button to the FileSystemDock. It’s created and connected in `_ready`, while `_enter_tree` and `_exit_tree` ensure it’s added and removed when the plugin is enabled or disabled.

Extending the Import Dock

In addition to the file system dock, Godot also has an import dock for managing imported assets. Here’s an example of extending its functionality:

func _enter_tree():
    add_control_to_dock(DOCK_SLOT_RIGHT_UL, my_custom_import_button)

var my_custom_import_button =

func _ready():
    my_custom_import_button.text = "Import Special"
    my_custom_import_button.connect("pressed", self, "_on_custom_import_button_pressed")

func _on_custom_import_button_pressed():
    # Implement your special import logic here

Not only does this method place a custom button in the right upper-left dock (where the import dock resides), but it also sets up a callback for when the button is pressed, allowing you to define custom import behavior.

Listening to Updates in the FileSystemDock

Lastly, you can listen to update signals from the FileSystemDock to react whenever a change has been made:

func _enter_tree():
    var fs_dock = get_editor_interface().get_filesystem_dock()
    fs_dock.connect("filesystem_dock_changed", self, "_on_filesystem_dock_changed")

func _on_filesystem_dock_changed():
    print("The FileSystemDock has been updated.")

This simple yet effective signal connection will inform you whenever the FileSystemDock’s state changes, be it file operations, navigations, or other modifications.

Implementing these examples will not only improve your game development workflow within Godot but also empower you to build even more complex editor extensions and customizations. Feel free to experiment with these snippets and integrate them into your Godot plugins for a more personalized and powerful development experience. We at Zenva are confident in the vast potential Godot offers, and we’re excited to see the innovative ways you’ll utilize FileSystemDock in your projects!

Continuing Your Game Development Journey with Godot

Now that we’ve explored the dynamic capabilities of the FileSystemDock in Godot 4, you might be wondering what’s next on your path to becoming a game development expert. One of the best ways to further enhance your skills is through structured learning and real-world practice.

We highly recommend checking out our Godot Game Development Mini-Degree. This comprehensive series of courses will guide you through the process of creating cross-platform games using the Godot engine. From the fundamentals to advanced topics such as 2D and 3D game mechanics, GDScript, and building various game genres, it has everything you need to become proficient in game development with Godot.

Furthermore, for those of you looking to diversify your knowledge base or find courses more tailored to your current skill level, our broad collection of Godot courses is the perfect destination. Whether you’re just starting out or looking to upgrade your existing expertise, Zenva’s library of courses will support you every step of the way.

Delve into the world of game creation with our top-notch content, and transform your passion for gaming into your most valuable skillset. Happy learning, and we can’t wait to see the amazing games you’ll create with Godot!


In this detailed exploration of Godot’s FileSystemDock, we’ve unlocked the door to streamlining your game development workflow, giving you the keys to efficiently manage your project’s assets and extend Godot’s editor to your liking. Remember, these examples are just the starting point; the true potential is realized when you apply them to your unique development processes. We’ve equipped you with the toolbox, but it’s your creative ingenuity that will build the masterpiece.

Dive deep into game creation with our Godot Game Development Mini-Degree and join a community of learners and experts alike on a journey to transform ideas into interactive realities. This is where your game development journey scales new heights—where your passion meets our expertise. So, are you ready to create, innovate, and elevate with Zenva? The adventure awaits!

Python Blog Image

FINAL DAYS: Unlock coding courses in Unity, Godot, Unreal, Python and more.