diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-06-09 10:47:32 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-06-14 19:56:20 +0200 |
commit | 1074017f043ec9155b12ea97cd00cf11361ccdf0 (patch) | |
tree | d286027835b2e02b89782b4f9a31a407d6b5651f /editor/editor_paths.h | |
parent | 16027e7cf412140c128e7c002ce0be533b94db00 (diff) | |
download | redot-engine-1074017f043ec9155b12ea97cd00cf11361ccdf0.tar.gz |
Refactor editor paths validation in EditorPaths and EditorSettings
- EditorSettings: Ensure that `create()` makes a valid singleton.
Fixes #49179, fixes #49450.
- EditorPaths: Cleanup code, properly set `paths_valid`.
- EditorPaths: Move more paths validation (check, mkdir) from
EditorSettings for a better separation of concerns.
- EditorPaths: Move EditorFileSystem creation of `.godot/imported`
next to other paths.
Diffstat (limited to 'editor/editor_paths.h')
-rw-r--r-- | editor/editor_paths.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/editor/editor_paths.h b/editor/editor_paths.h index c1be33f5c2..2c156b7c96 100644 --- a/editor/editor_paths.h +++ b/editor/editor_paths.h @@ -28,20 +28,22 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef EDITORPATHS_H -#define EDITORPATHS_H +#ifndef EDITOR_PATHS_H +#define EDITOR_PATHS_H -#include "core/config/engine.h" +#include "core/object/class_db.h" +#include "core/string/ustring.h" class EditorPaths : public Object { GDCLASS(EditorPaths, Object) - bool paths_valid = false; - String data_dir; //editor data dir - String config_dir; //editor config dir - String cache_dir; //editor cache dir - bool self_contained = false; //true if running self contained - String self_contained_file; //self contained file with configuration + bool paths_valid = false; // If any of the paths can't be created, this is false. + String data_dir; // Editor data (templates, shader cache, etc.). + String config_dir; // Editor config (settings, profiles, themes, etc.). + String cache_dir; // Editor cache (thumbnails, tmp generated files). + String project_data_dir = "res://.godot"; // Project-specific data (metadata, shader cache, etc.). + bool self_contained = false; // Self-contained means everything goes to `editor_data` dir. + String self_contained_file; // Self-contained file with configuration. static EditorPaths *singleton; @@ -54,6 +56,8 @@ public: String get_data_dir() const; String get_config_dir() const; String get_cache_dir() const; + String get_project_data_dir() const; + bool is_self_contained() const; String get_self_contained_file() const; @@ -61,10 +65,10 @@ public: return singleton; } - static void create(bool p_for_project_manager); + static void create(); static void free(); - EditorPaths(bool p_for_project_mamanger = false); + EditorPaths(); }; -#endif // EDITORPATHS_H +#endif // EDITOR_PATHS_H |