From 0031293ac7f9afa7979f62dce1884b83f8f2f4ce Mon Sep 17 00:00:00 2001 From: Petr Gladkikh Date: Wed, 8 Nov 2023 17:02:42 +0100 Subject: [PATCH] Correct project initialization --- src/project.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/project.rs b/src/project.rs index 31ef166..1d2142d 100644 --- a/src/project.rs +++ b/src/project.rs @@ -25,19 +25,12 @@ impl Project { let mut snapshots_dir = directory.clone(); snapshots_dir.push(Self::SNAPSHOTS_DIR_NAME); - if !snapshots_dir.is_dir() { - fs::create_dir_all(&snapshots_dir).expect("create snapshots directory"); - } - let mut history = if directory.is_dir() { + let mut history = if snapshots_dir.is_dir() { TrackHistory::with_directory(&snapshots_dir) } else { - fs::create_dir_all(&directory).expect( - format!( - "Cannot create project directory {:?}", - directory.to_string_lossy() - ) - .as_str(), + fs::create_dir_all(&snapshots_dir).expect( + format!("create project directory {:?}", directory.to_string_lossy()).as_str(), ); TrackHistory::with_directory(&snapshots_dir).init(&source_file) };