summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2020-10-11 13:06:30 -0400
committerAaron Franke <arnfranke@yahoo.com>2021-02-02 14:14:37 -0500
commitee798c4f492fcc41527918e903ca9a91007970b5 (patch)
tree663d25761e759780734478b45ebc9a32a5ff24fb /editor
parent9e0bdeb5de323f5ec7c21511478a2b2524e70fc3 (diff)
Move project-specific editor data into res://.godot/editor
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_settings.cpp32
-rw-r--r--editor/editor_settings.h1
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;