Documentation
¶
Overview ¶
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 graphics.gd/classdb/Engine.HasSingleton 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.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AsEditorPaths() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) GetCacheDir() string
- func (self Instance) GetConfigDir() string
- func (self Instance) GetDataDir() string
- func (self Instance) GetProjectSettingsDir() string
- func (self Instance) GetSelfContainedFile() string
- func (self Instance) ID() ID
- func (self Instance) IsSelfContained() bool
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsEditorPaths ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.EditorPaths
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsEditorPaths ¶
func (Instance) 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:
func (Instance) 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:
func (Instance) 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:
func (Instance) 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.
func (Instance) 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 Instance.IsSelfContained.
func (Instance) 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 Instance.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.