diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index cd30a323d2a..e841427e84c 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -65,6 +65,7 @@ String ProjectSettings::get_resource_path() const { return resource_path; } +// This returns paths like "res://.godot/imported". String ProjectSettings::get_imported_files_path() const { return get_project_data_path().path_join("imported"); } diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 880a7ed4d1e..fde655f737d 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -49,6 +49,7 @@ class ProjectSettings : public Object { public: typedef HashMap CustomMap; + // This constant is used to make the ".godot" folder and paths like "res://.godot/editor". static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot"; static inline const String EDITOR_SETTING_OVERRIDE_PREFIX = PNAME("editor_overrides") + String("/"); diff --git a/doc/classes/EditorPaths.xml b/doc/classes/EditorPaths.xml index f57e728c93a..c355f06ad6c 100644 --- a/doc/classes/EditorPaths.xml +++ b/doc/classes/EditorPaths.xml @@ -51,7 +51,7 @@ - Returns the project-specific editor settings path. Projects all have a unique subdirectory inside the settings path where project-specific editor settings are saved. + Returns the relative path to the editor settings for this project. This is usually [code]"res://.godot/editor"[/code]. Projects all have a unique subdirectory inside the settings path where project-specific editor settings are saved. diff --git a/editor/file_system/editor_paths.cpp b/editor/file_system/editor_paths.cpp index bb80f2f616a..b8dc77e7dc2 100644 --- a/editor/file_system/editor_paths.cpp +++ b/editor/file_system/editor_paths.cpp @@ -83,6 +83,7 @@ String EditorPaths::get_debug_keystore_path() const { #endif } +// This returns paths like "res://.godot/editor". String EditorPaths::get_project_settings_dir() const { return get_project_data_dir().path_join("editor"); } diff --git a/modules/dds/tests/test_dds.h b/modules/dds/tests/test_dds.h index 8f723a446ef..3029bc9c97b 100644 --- a/modules/dds/tests/test_dds.h +++ b/modules/dds/tests/test_dds.h @@ -43,20 +43,21 @@ namespace TestDDS { String init(const String &p_test, const String &p_copy_target = String()) { String old_resource_path = TestProjectSettingsInternalsAccessor::resource_path(); Error err; - // Setup project settings since it's needed for the import process. + // Setup project settings with `res://` set to a temporary path. String project_folder = TestUtils::get_temp_path(p_test.get_file().get_basename()); - Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - da->make_dir_recursive(project_folder.path_join(".godot").path_join("imported")); - // Initialize res:// to `project_folder`. TestProjectSettingsInternalsAccessor::resource_path() = project_folder; - err = ProjectSettings::get_singleton()->setup(project_folder, String(), true); + ProjectSettings *ps = ProjectSettings::get_singleton(); + err = ps->setup(project_folder, String(), true); + + // Create the imported files folder as the editor import process expects it to exist. + Ref da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + da->make_dir_recursive(ps->globalize_path(ps->get_imported_files_path())); if (p_copy_target.is_empty()) { return old_resource_path; } // Copy all the necessary test data files to the res:// directory. - da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); String test_data = String("tests/data").path_join(p_test); da = DirAccess::open(test_data); CHECK_MESSAGE(da.is_valid(), "Unable to open folder."); diff --git a/modules/gltf/tests/test_gltf.h b/modules/gltf/tests/test_gltf.h index 0c7e9edab16..f673c8a1829 100644 --- a/modules/gltf/tests/test_gltf.h +++ b/modules/gltf/tests/test_gltf.h @@ -134,20 +134,21 @@ static Node *gltf_export_then_import(Node *p_root, const String &p_test_name) { void init(const String &p_test, const String &p_copy_target = String()) { Error err; - // Setup project settings since it's needed for the import process. + // Setup project settings with `res://` set to a temporary path. String project_folder = TestUtils::get_temp_path(p_test.get_file().get_basename()); - Ref da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - da->make_dir_recursive(project_folder.path_join(".godot").path_join("imported")); - // Initialize res:// to `project_folder`. TestProjectSettingsInternalsAccessor::resource_path() = project_folder; - err = ProjectSettings::get_singleton()->setup(project_folder, String(), true); + ProjectSettings *ps = ProjectSettings::get_singleton(); + err = ps->setup(project_folder, String(), true); + + // Create the imported files folder as the editor import process expects it to exist. + Ref da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + da->make_dir_recursive(ps->globalize_path(ps->get_imported_files_path())); if (p_copy_target.is_empty()) { return; } // Copy all the necessary test data files to the res:// directory. - da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); String test_data = String("modules/gltf/tests/data/").path_join(p_test); da = DirAccess::open(test_data); CHECK_MESSAGE(da.is_valid(), "Unable to open folder.");