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
+3 -3
View File
@@ -61,7 +61,7 @@ impl App {
self.np_status = format!("{} already exists.", parent.join(&name).display());
return;
}
let template = self.config.project_template.clone();
let template = self.config.effective_project_template();
// Check that the template directory exists
if !template.is_dir() {
@@ -600,8 +600,8 @@ impl App {
if browse_template {
let mut dialog = rfd::FileDialog::new().set_title("Choose a cookiecutter template");
if self.config.project_template.is_dir() {
dialog = dialog.set_directory(&self.config.project_template);
if self.config.effective_project_template().is_dir() {
dialog = dialog.set_directory(&self.config.effective_project_template());
}
if let Some(path) = dialog.pick_folder() {
self.config.project_template = path;