Skip to content

Commit

Permalink
Merge pull request godotengine#96845 from bruvzg/edconfig
Browse files Browse the repository at this point in the history
[Editor] Add .editorconfig to the projects.
  • Loading branch information
akien-mga committed Sep 11, 2024
2 parents 8613f34 + 14dee6e commit 4788f54
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions editor/editor_paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,18 +245,34 @@ EditorPaths::EditorPaths() {
}
}

// Check that the project data directory '.gdignore' file exists
// Check that the project data directory `.gdignore` file exists.
String project_data_gdignore_file_path = project_data_dir.path_join(".gdignore");
if (!FileAccess::exists(project_data_gdignore_file_path)) {
// Add an empty .gdignore file to avoid scan.
Ref<FileAccess> f = FileAccess::open(project_data_gdignore_file_path, FileAccess::WRITE);
if (f.is_valid()) {
f->store_line("");
} else {
ERR_PRINT("Failed to create file " + project_data_gdignore_file_path);
ERR_PRINT("Failed to create file " + project_data_gdignore_file_path.quote() + ".");
}
}

// Check that `.editorconfig` file exists.
String project_editorconfig_path = "res://.editorconfig";
if (!FileAccess::exists(project_editorconfig_path)) {
Ref<FileAccess> f = FileAccess::open(project_editorconfig_path, FileAccess::WRITE);
if (f.is_valid()) {
f->store_line("root = true");
f->store_line("");
f->store_line("[*]");
f->store_line("charset = utf-8");
f->close();
} else {
ERR_PRINT("Failed to create file " + project_editorconfig_path.quote() + ".");
}
FileAccess::set_hidden_attribute(project_editorconfig_path, true);
}

Engine::get_singleton()->set_shader_cache_path(project_data_dir);

// Editor metadata dir.
Expand Down

0 comments on commit 4788f54

Please sign in to comment.