summaryrefslogtreecommitdiff
path: root/editor/editor_paths.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_paths.cpp')
-rw-r--r--editor/editor_paths.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/editor/editor_paths.cpp b/editor/editor_paths.cpp
index c9817190dd..e747cdc29e 100644
--- a/editor/editor_paths.cpp
+++ b/editor/editor_paths.cpp
@@ -87,6 +87,8 @@ void EditorPaths::_bind_methods() {
EditorPaths::EditorPaths() {
singleton = this;
+ project_data_dir = ProjectSettings::get_singleton()->get_project_data_path();
+
// Self-contained mode if a `._sc_` or `_sc_` file is present in executable dir.
String exe_path = OS::get_singleton()->get_executable_path().get_base_dir();
{
@@ -129,7 +131,7 @@ EditorPaths::EditorPaths() {
}
}
- paths_valid = (data_path != "" && config_path != "" && cache_path != "");
+ paths_valid = (!data_path.is_empty() && !config_path.is_empty() && !cache_path.is_empty());
ERR_FAIL_COND_MSG(!paths_valid, "Editor data, config, or cache paths are invalid.");
// Validate or create each dir and its relevant subdirectories.
@@ -183,7 +185,7 @@ EditorPaths::EditorPaths() {
}
}
- // Validate or create project-specific editor data dir (`res://.godot`),
+ // Validate or create project-specific editor data dir,
// including shader cache subdir.
if (Main::is_project_manager() || Main::is_cmdline_tool()) {
@@ -198,6 +200,20 @@ EditorPaths::EditorPaths() {
paths_valid = false;
}
}
+
+ // Check that the project data directory '.gdignore' file exists
+ String project_data_gdignore_file_path = project_data_dir.plus_file(".gdignore");
+ if (!FileAccess::exists(project_data_gdignore_file_path)) {
+ // Add an empty .gdignore file to avoid scan.
+ FileAccessRef f = FileAccess::open(project_data_gdignore_file_path, FileAccess::WRITE);
+ if (f) {
+ f->store_line("");
+ f->close();
+ } else {
+ ERR_PRINT("Failed to create file " + project_data_gdignore_file_path);
+ }
+ }
+
Engine::get_singleton()->set_shader_cache_path(project_data_dir);
// Editor metadata dir.
@@ -205,8 +221,9 @@ EditorPaths::EditorPaths() {
dir_res->make_dir("editor");
}
// Imported assets dir.
- if (!dir_res->dir_exists(ProjectSettings::IMPORTED_FILES_PATH)) {
- dir_res->make_dir(ProjectSettings::IMPORTED_FILES_PATH);
+ String imported_files_path = ProjectSettings::get_singleton()->get_imported_files_path();
+ if (!dir_res->dir_exists(imported_files_path)) {
+ dir_res->make_dir(imported_files_path);
}
}
}