From 5172e2cb5780a683192537c8add2c316790e5a64 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 11 Mar 2019 17:52:57 +0100 Subject: [PATCH] Create parent directory only --- src/git.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/git.rs b/src/git.rs index 1444b8d..cd43cf9 100644 --- a/src/git.rs +++ b/src/git.rs @@ -92,7 +92,10 @@ fn clone_dirty>(url: &str, place: P) -> Result<()> { return Err(Error::PathAlreadyExists); } - create_dir_all(place)?; + // Need to create the parent dir only if it exists + if let Some(parent) = place.parent() { + create_dir_all(parent)?; + } let command = Command::new("git") .args(&["clone", &url, &place.display().to_string()])