1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Provide a getter for the project data directory.

This commit is contained in:
ne0fhyk
2021-09-10 08:32:29 -07:00
parent 729461b2a4
commit 69f890ff11
18 changed files with 67 additions and 34 deletions

View File

@@ -2147,6 +2147,10 @@ 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()) {
return true;
}
if (FileAccess::exists(p_path.plus_file("project.godot"))) {
// skip if another project inside this
return true;
@@ -2212,7 +2216,7 @@ void EditorFileSystem::move_group_file(const String &p_path, const String &p_new
}
ResourceUID::ID EditorFileSystem::_resource_saver_get_resource_id_for_path(const String &p_path, bool p_generate) {
if (!p_path.is_resource_file() || p_path.begins_with("res://.godot")) {
if (!p_path.is_resource_file() || p_path.begins_with(ProjectSettings::get_singleton()->get_project_data_path())) {
//saved externally (configuration file) or internal file, do not assign an ID.
return ResourceUID::INVALID_ID;
}
@@ -2270,17 +2274,18 @@ bool EditorFileSystem::_scan_extensions() {
}
}
String extension_list_config_file = NativeExtension::get_extension_list_config_file();
if (extensions.size()) {
if (extensions_added.size() || extensions_removed.size()) { //extensions were added or removed
FileAccessRef f = FileAccess::open(NativeExtension::EXTENSION_LIST_CONFIG_FILE, FileAccess::WRITE);
FileAccessRef f = FileAccess::open(extension_list_config_file, FileAccess::WRITE);
for (const String &E : extensions) {
f->store_line(E);
}
}
} else {
if (loaded_extensions.size() || FileAccess::exists(NativeExtension::EXTENSION_LIST_CONFIG_FILE)) { //extensions were removed
if (loaded_extensions.size() || FileAccess::exists(extension_list_config_file)) { //extensions were removed
DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
da->remove(NativeExtension::EXTENSION_LIST_CONFIG_FILE);
da->remove(extension_list_config_file);
}
}