diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-02 22:19:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 22:19:43 +0100 |
commit | 0e3fb44d4e122702bac8368339e8e66b102c8480 (patch) | |
tree | 8013d97343bb0c91a5a42e67dc8de49e088ed256 | |
parent | cc95e2c6a6067f7245bf7ba640ab4c34983cfe8f (diff) | |
parent | ee798c4f492fcc41527918e903ca9a91007970b5 (diff) |
Merge pull request #42394 from aaronfranke/editor-dotgodot
Move project-specific editor data into res://.godot/editor
-rw-r--r-- | editor/editor_settings.cpp | 32 | ||||
-rw-r--r-- | editor/editor_settings.h | 1 |
2 files changed, 11 insertions, 22 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 7a602912c9..9908f5727e 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -959,27 +959,16 @@ void EditorSettings::create() { _create_script_templates(dir->get_current_dir().plus_file("script_templates")); - if (dir->change_dir("projects") != OK) { - dir->make_dir("projects"); - } else { - dir->change_dir(".."); - } - - // Validate/create project-specific config dir - - dir->change_dir("projects"); - String project_config_dir = ProjectSettings::get_singleton()->get_resource_path(); - if (project_config_dir.ends_with("/")) { - project_config_dir = config_path.substr(0, project_config_dir.size() - 1); - } - project_config_dir = project_config_dir.get_file() + "-" + project_config_dir.md5_text(); - - if (dir->change_dir(project_config_dir) != OK) { - dir->make_dir(project_config_dir); - } else { - dir->change_dir(".."); + { + // Validate/create project-specific editor settings dir. + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + if (da->change_dir(EditorSettings::PROJECT_EDITOR_SETTINGS_PATH) != OK) { + Error err = da->make_dir_recursive(EditorSettings::PROJECT_EDITOR_SETTINGS_PATH); + if (err || da->change_dir(EditorSettings::PROJECT_EDITOR_SETTINGS_PATH) != OK) { + ERR_FAIL_MSG("Failed to create '" + EditorSettings::PROJECT_EDITOR_SETTINGS_PATH + "' folder."); + } + } } - dir->change_dir(".."); // Validate editor config file @@ -1001,7 +990,6 @@ void EditorSettings::create() { singleton->save_changed_setting = true; singleton->config_file_path = config_file_path; - singleton->project_config_dir = project_config_dir; singleton->settings_dir = config_dir; singleton->data_dir = data_dir; singleton->cache_dir = cache_dir; @@ -1277,7 +1265,7 @@ String EditorSettings::get_settings_dir() const { } String EditorSettings::get_project_settings_dir() const { - return get_settings_dir().plus_file("projects").plus_file(project_config_dir); + return EditorSettings::PROJECT_EDITOR_SETTINGS_PATH; } String EditorSettings::get_text_editor_themes_dir() const { diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 61ec8546aa..616a938a86 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -46,6 +46,7 @@ class EditorSettings : public Resource { _THREAD_SAFE_CLASS_ public: + inline static const String PROJECT_EDITOR_SETTINGS_PATH = "res://.godot/editor"; struct Plugin { EditorPlugin *instance = nullptr; String path; |