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:
+3
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user