Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
if a project is not init and a generated directory exists, delete it …
Browse files Browse the repository at this point in the history
…before generating a new one
  • Loading branch information
hugodutka committed Nov 8, 2020
1 parent 77c9a70 commit 7006151
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/action/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::core::shell::{native_code_command, run_command};
use crate::core::state::ProjectState;
use anyhow::{Context, Result};
use fs_extra::dir;
use std::fs::remove_dir_all;
use std::process::Command;

impl Action for OpenCmd {
Expand All @@ -19,6 +20,9 @@ impl Action for OpenCmd {

if !project_state.is_init {
println!("Generating the user folder from user_template");
if generated_dir.exists() {
remove_dir_all(&generated_dir)?;
}
let mut options = dir::CopyOptions::new();
options.copy_inside = true;
dir::copy(project_dir.join("user_template"), &generated_dir, &options)
Expand Down

0 comments on commit 7006151

Please sign in to comment.