summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorne0fhyk <fhuyakou@gmail.com>2021-09-10 08:32:29 -0700
committerne0fhyk <fhuyakou@gmail.com>2021-10-11 14:40:14 -0700
commit3e44a6375e775c34898acefd17ffde0116d3b533 (patch)
treed0e162c744845660f3ec9b8334c825841bf279c1 /editor
parentf930d54140c65cedc1d24b2907f8ae33c39b76f0 (diff)
Make the project data directory customizable.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_file_system.cpp2
-rw-r--r--editor/editor_paths.cpp14
-rw-r--r--editor/find_in_files.cpp2
3 files changed, 16 insertions, 2 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 6fef65c92d..767856f939 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -2163,7 +2163,7 @@ Error EditorFileSystem::_resource_import(const String &p_path) {
}
bool EditorFileSystem::_should_skip_directory(const String &p_path) {
- if (p_path == ProjectSettings::get_singleton()->get_project_data_path()) {
+ if (p_path.begins_with(ProjectSettings::get_singleton()->get_project_data_path())) {
return true;
}
diff --git a/editor/editor_paths.cpp b/editor/editor_paths.cpp
index 71f13c0c2f..5b48cc2638 100644
--- a/editor/editor_paths.cpp
+++ b/editor/editor_paths.cpp
@@ -200,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.
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 283496c0f1..b61f6e12eb 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -235,7 +235,7 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
// Ignore special dirs (such as .git and project data directory)
String project_data_dir_name = ProjectSettings::get_singleton()->get_project_data_dir_name();
- if (file.begins_with(".") || file == project_data_dir_name) {
+ if (file.begins_with(".") || file.begins_with(project_data_dir_name)) {
continue;
}
if (dir->current_is_hidden()) {