fix: Add effective_project_template() to fallback to bundled template

- Add effective_project_template() method that checks if saved template path exists
- If not, falls back to default_project_template() (bundled template)
- This handles users who have old config.json pointing to deleted Cookiecutters path
- Update project.rs to use effective_project_template() when creating new projects

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-09-16 18:49:46 -05:00
parent 3392b7e4d3
commit c61a7b605a
2 changed files with 14 additions and 3 deletions
+11
View File
@@ -427,6 +427,17 @@ impl Config {
}
}
/// The project template path to use, falling back to the bundled template
/// if the saved path doesn't exist.
pub fn effective_project_template(&self) -> PathBuf {
// If the saved template path exists and has cookiecutter.json, use it
if self.project_template.join("cookiecutter.json").is_file() {
return self.project_template.clone();
}
// Otherwise fall back to the bundled template
default_project_template()
}
pub fn load() -> Config {
let path = config_path();
match std::fs::read_to_string(&path) {