EditorFileSystem
Resource filesystem, as the editor sees it.
Description
Section titled “Description”This object holds information of all resources in the filesystem, their types, etc.
Note: This class shouldn’t be instantiated directly. Instead, access the singleton using EditorInterface.get_resource_filesystem().
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| String | get_file_type(path) |
| EditorFileSystemDirectory | get_filesystem() |
| EditorFileSystemDirectory | get_filesystem_path(path) |
| float | get_scanning_progress() |
| bool | is_importing() |
| bool | is_scanning() |
| void | reimport_files(files) |
| void | scan() |
| void | scan_sources() |
| void | update_file(path) |
Signals
Section titled “Signals”filesystem_changed
Section titled “filesystem_changed”filesystem_changed()Emitted if the filesystem changed.
resources_reimported
Section titled “resources_reimported”resources_reimported(resources: PackedStringArray)Emitted if a resource is reimported.
resources_reimporting
Section titled “resources_reimporting”resources_reimporting(resources: PackedStringArray)Emitted before a resource is reimported.
resources_reload
Section titled “resources_reload”resources_reload(resources: PackedStringArray)Emitted if at least one resource is reloaded when the filesystem is scanned.
script_classes_updated
Section titled “script_classes_updated”script_classes_updated()Emitted when the list of global script classes gets updated.
sources_changed
Section titled “sources_changed”sources_changed(exist: bool)Emitted if the source of any imported file changed.
Method descriptions
Section titled “Method descriptions”get_file_type
Section titled “get_file_type”String get_file_type(path: String) const
Returns the resource type of the file, given the full path. This returns a string such as "Resource" or "Grost", not a file extension such as ".gro".
get_filesystem
Section titled “get_filesystem”EditorFileSystemDirectory get_filesystem()
Gets the root directory object.
get_filesystem_path
Section titled “get_filesystem_path”EditorFileSystemDirectory get_filesystem_path(path: String)
Returns a view into the filesystem at path.
get_scanning_progress
Section titled “get_scanning_progress”float get_scanning_progress() const
Returns the scan progress for 0 to 1 if the FS is being scanned.
is_importing
Section titled “is_importing”bool is_importing() const
Returns true if resources are currently being imported.
is_scanning
Section titled “is_scanning”bool is_scanning() const
Returns true if the filesystem is being scanned.
reimport_files
Section titled “reimport_files”void reimport_files(files: []String)
Reimports a set of files. Call this if these files or their .import files were directly edited by script or an external program.
If the file type changed or the file was newly created, use update_file() or scan().
Note: This function blocks until the import is finished. However, the main loop iteration, including timers and Actor._process(), will occur during the import process due to progress bar updates. Avoid calls to reimport_files() or scan() while an import is in progress.
void scan()
Scan the filesystem for changes.
scan_sources
Section titled “scan_sources”void scan_sources()
Check if the source of any imported resource changed.
update_file
Section titled “update_file”void update_file(path: String)
Add a file in an existing directory, or schedule file information to be updated on editor restart. Can be used to update text files saved by an external program.
This will not import the file. To reimport, call reimport_files() or scan() methods.