godot/doc/classes/EditorPaths.xml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
4.8 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorPaths" inherits="Object" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
2021-11-14 02:00:15 +08:00
Editor-only singleton that returns paths to various OS-specific data folders and files.
</brief_description>
<description>
2021-11-14 02:00:15 +08:00
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.
[b]Note:[/b] 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 [method Engine.has_singleton] to check whether the singleton is available before using it.
[b]Note:[/b] On the Linux/BSD platform, Godot complies with the [url=https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html]XDG Base Directory Specification[/url]. You can override environment variables following the specification to change the editor and project data paths.
</description>
<tutorials>
2023-02-28 20:38:01 +08:00
<link title="File paths in Godot projects">$DOCS_URL/tutorials/io/data_paths.html</link>
</tutorials>
<methods>
<method name="get_cache_dir" qualifiers="const">
<return type="String" />
<description>
2021-11-14 02:00:15 +08:00
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).
[b]Default paths per platform:[/b]
[codeblock]
- Windows: %LOCALAPPDATA%\Godot\
- macOS: ~/Library/Caches/Godot/
- Linux: ~/.cache/godot/
[/codeblock]
</description>
</method>
<method name="get_config_dir" qualifiers="const">
<return type="String" />
<description>
2021-11-14 02:00:15 +08:00
Returns the absolute path to the user's configuration folder. This folder should be used for [i]persistent[/i] user configuration files.
[b]Default paths per platform:[/b]
[codeblock]
- Windows: %APPDATA%\Godot\ (same as `get_data_dir()`)
- macOS: ~/Library/Application Support/Godot/ (same as `get_data_dir()`)
- Linux: ~/.config/godot/
[/codeblock]
</description>
</method>
<method name="get_data_dir" qualifiers="const">
<return type="String" />
<description>
2021-11-14 02:00:15 +08:00
Returns the absolute path to the user's data folder. This folder should be used for [i]persistent[/i] user data files such as installed export templates.
[b]Default paths per platform:[/b]
[codeblock]
- Windows: %APPDATA%\Godot\ (same as `get_config_dir()`)
- macOS: ~/Library/Application Support/Godot/ (same as `get_config_dir()`)
- Linux: ~/.local/share/godot/
[/codeblock]
</description>
</method>
<method name="get_project_settings_dir" qualifiers="const">
<return type="String" />
<description>
Returns the project-specific editor settings path. Projects all have a unique subdirectory inside the settings path where project-specific editor settings are saved.
</description>
</method>
<method name="get_self_contained_file" qualifiers="const">
<return type="String" />
<description>
2021-11-14 02:00:15 +08:00
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 [method is_self_contained].
</description>
</method>
<method name="is_self_contained" qualifiers="const">
<return type="bool" />
<description>
2021-11-14 02:00:15 +08:00
Returns [code]true[/code] if the editor is marked as self-contained, [code]false[/code] otherwise. When self-contained mode is enabled, user configuration, data and cache files are saved in an [code]editor_data/[/code] 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 [code]._sc_[/code] or [code]_sc_[/code] in the same folder as the editor binary or macOS .app bundle while the editor is not running. See also [method get_self_contained_file].
[b]Note:[/b] On macOS, quarantine flag should be manually removed before using self-contained mode, see [url=https://docs.godotengine.org/en/stable/tutorials/export/running_on_macos.html]Running on macOS[/url].
[b]Note:[/b] On macOS, placing [code]_sc_[/code] 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.
2021-11-14 02:00:15 +08:00
[b]Note:[/b] The Steam release of Godot uses self-contained mode by default.
</description>
</method>
</methods>
</class>