Table of Contents

Class EditorPaths

Namespace
Godot
Assembly
GodotSharpEditor.dll

This editor-only singleton returns OS-specific paths to various data folders and files. It can be used in editor plugins to ensure files are saved in the correct location on each operating system.

Note: This singleton is not accessible in exported projects. Attempting to access it in an exported project will result in a script error as the singleton won't be declared. To prevent script errors in exported projects, use HasSingleton(StringName) to check whether the singleton is available before using it.

Note: On the Linux/BSD platform, Godot complies with the XDG Base Directory Specification. You can override environment variables following the specification to change the editor and project data paths.

public class EditorPaths : GodotObject, IDisposable
Inheritance
EditorPaths
Implements
Inherited Members

Constructors

EditorPaths()

public EditorPaths()

Methods

GetCacheDir()

Returns the absolute path to the user's cache folder. This folder should be used for temporary data that can be removed safely whenever the editor is closed (such as generated resource thumbnails).

Default paths per platform:

- Windows: %LOCALAPPDATA%\Godot\
  - macOS: ~/Library/Caches/Godot/
  - Linux: ~/.cache/godot/
public string GetCacheDir()

Returns

string

GetConfigDir()

Returns the absolute path to the user's configuration folder. This folder should be used for persistent user configuration files.

Default paths per platform:

- Windows: %APPDATA%\Godot\                    (same as `get_data_dir()`)
  - macOS: ~/Library/Application Support/Godot/  (same as `get_data_dir()`)
  - Linux: ~/.config/godot/
public string GetConfigDir()

Returns

string

GetDataDir()

Returns the absolute path to the user's data folder. This folder should be used for persistent user data files such as installed export templates.

Default paths per platform:

- Windows: %APPDATA%\Godot\                    (same as `get_config_dir()`)
  - macOS: ~/Library/Application Support/Godot/  (same as `get_config_dir()`)
  - Linux: ~/.local/share/godot/
public string GetDataDir()

Returns

string

GetProjectSettingsDir()

Returns the project-specific editor settings path. Projects all have a unique subdirectory inside the settings path where project-specific editor settings are saved.

public string GetProjectSettingsDir()

Returns

string

GetSelfContainedFile()

Returns the absolute path to the self-contained file that makes the current Godot editor instance be considered as self-contained. Returns an empty string if the current Godot editor instance isn't self-contained. See also IsSelfContained().

public string GetSelfContainedFile()

Returns

string

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsSelfContained()

Returns true if the editor is marked as self-contained, false otherwise. When self-contained mode is enabled, user configuration, data and cache files are saved in an editor_data/ folder next to the editor binary. This makes portable usage easier and ensures the Godot editor minimizes file writes outside its own folder. Self-contained mode is not available for exported projects.

Self-contained mode can be enabled by creating a file named ._sc_ or _sc_ in the same folder as the editor binary or macOS .app bundle while the editor is not running. See also GetSelfContainedFile().

Note: On macOS, quarantine flag should be manually removed before using self-contained mode, see Running on macOS.

Note: On macOS, placing _sc_ or any other file inside .app bundle will break digital signature and make it non-portable, consider placing it in the same folder as the .app bundle instead.

Note: The Steam release of Godot uses self-contained mode by default.

public bool IsSelfContained()

Returns

bool