class_editorpaths.rst 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorPaths.xml.
  6. .. _class_EditorPaths:
  7. EditorPaths
  8. ===========
  9. **Inherits:** :ref:`Object<class_Object>`
  10. Editor-only singleton that returns paths to various OS-specific data folders and files.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. \ **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 :ref:`Engine.has_singleton<class_Engine_method_has_singleton>` to check whether the singleton is available before using it.
  16. \ **Note:** On the Linux/BSD platform, Godot complies with the `XDG Base Directory Specification <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>`__. You can override environment variables following the specification to change the editor and project data paths.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`File paths in Godot projects <../tutorials/io/data_paths>`
  21. .. rst-class:: classref-reftable-group
  22. Methods
  23. -------
  24. .. table::
  25. :widths: auto
  26. +-----------------------------+--------------------------------------------------------------------------------------------------+
  27. | :ref:`String<class_String>` | :ref:`get_cache_dir<class_EditorPaths_method_get_cache_dir>`\ (\ ) |const| |
  28. +-----------------------------+--------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_String>` | :ref:`get_config_dir<class_EditorPaths_method_get_config_dir>`\ (\ ) |const| |
  30. +-----------------------------+--------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_String>` | :ref:`get_data_dir<class_EditorPaths_method_get_data_dir>`\ (\ ) |const| |
  32. +-----------------------------+--------------------------------------------------------------------------------------------------+
  33. | :ref:`String<class_String>` | :ref:`get_project_settings_dir<class_EditorPaths_method_get_project_settings_dir>`\ (\ ) |const| |
  34. +-----------------------------+--------------------------------------------------------------------------------------------------+
  35. | :ref:`String<class_String>` | :ref:`get_self_contained_file<class_EditorPaths_method_get_self_contained_file>`\ (\ ) |const| |
  36. +-----------------------------+--------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`is_self_contained<class_EditorPaths_method_is_self_contained>`\ (\ ) |const| |
  38. +-----------------------------+--------------------------------------------------------------------------------------------------+
  39. .. rst-class:: classref-section-separator
  40. ----
  41. .. rst-class:: classref-descriptions-group
  42. Method Descriptions
  43. -------------------
  44. .. _class_EditorPaths_method_get_cache_dir:
  45. .. rst-class:: classref-method
  46. :ref:`String<class_String>` **get_cache_dir**\ (\ ) |const| :ref:`🔗<class_EditorPaths_method_get_cache_dir>`
  47. 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).
  48. \ **Default paths per platform:**\
  49. .. code:: text
  50. - Windows: %LOCALAPPDATA%\Godot\
  51. - macOS: ~/Library/Caches/Godot/
  52. - Linux: ~/.cache/godot/
  53. .. rst-class:: classref-item-separator
  54. ----
  55. .. _class_EditorPaths_method_get_config_dir:
  56. .. rst-class:: classref-method
  57. :ref:`String<class_String>` **get_config_dir**\ (\ ) |const| :ref:`🔗<class_EditorPaths_method_get_config_dir>`
  58. Returns the absolute path to the user's configuration folder. This folder should be used for *persistent* user configuration files.
  59. \ **Default paths per platform:**\
  60. .. code:: text
  61. - Windows: %APPDATA%\Godot\ (same as `get_data_dir()`)
  62. - macOS: ~/Library/Application Support/Godot/ (same as `get_data_dir()`)
  63. - Linux: ~/.config/godot/
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_EditorPaths_method_get_data_dir:
  67. .. rst-class:: classref-method
  68. :ref:`String<class_String>` **get_data_dir**\ (\ ) |const| :ref:`🔗<class_EditorPaths_method_get_data_dir>`
  69. 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.
  70. \ **Default paths per platform:**\
  71. .. code:: text
  72. - Windows: %APPDATA%\Godot\ (same as `get_config_dir()`)
  73. - macOS: ~/Library/Application Support/Godot/ (same as `get_config_dir()`)
  74. - Linux: ~/.local/share/godot/
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_EditorPaths_method_get_project_settings_dir:
  78. .. rst-class:: classref-method
  79. :ref:`String<class_String>` **get_project_settings_dir**\ (\ ) |const| :ref:`🔗<class_EditorPaths_method_get_project_settings_dir>`
  80. Returns the project-specific editor settings path. Projects all have a unique subdirectory inside the settings path where project-specific editor settings are saved.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _class_EditorPaths_method_get_self_contained_file:
  84. .. rst-class:: classref-method
  85. :ref:`String<class_String>` **get_self_contained_file**\ (\ ) |const| :ref:`🔗<class_EditorPaths_method_get_self_contained_file>`
  86. 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 :ref:`is_self_contained<class_EditorPaths_method_is_self_contained>`.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_EditorPaths_method_is_self_contained:
  90. .. rst-class:: classref-method
  91. :ref:`bool<class_bool>` **is_self_contained**\ (\ ) |const| :ref:`🔗<class_EditorPaths_method_is_self_contained>`
  92. 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.
  93. 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 :ref:`get_self_contained_file<class_EditorPaths_method_get_self_contained_file>`.
  94. \ **Note:** On macOS, quarantine flag should be manually removed before using self-contained mode, see `Running on macOS <https://docs.godotengine.org/en/stable/tutorials/export/running_on_macos.html>`__.
  95. \ **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.
  96. \ **Note:** The Steam release of Godot uses self-contained mode by default.
  97. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  98. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  99. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  100. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  101. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  102. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  103. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  104. .. |void| replace:: :abbr:`void (No return value.)`