diff --git a/src/creator/mod.rs b/src/creator/mod.rs index 6c184fd..7eb5fea 100644 --- a/src/creator/mod.rs +++ b/src/creator/mod.rs @@ -40,6 +40,7 @@ impl Creator { .into_iter() .filter(Result::is_ok) .map(|x| x.unwrap().path().to_path_buf()) + .filter(|x| !x.is_dir()) .collect::>(); env::set_current_dir(d)?; Ok(Self { @@ -49,10 +50,15 @@ impl Creator { }) } - pub fn from_list(list: &[&str], specs: Specs) -> Result { + pub fn from_list(list: &[&str], path: Option<&Path>, specs: Specs) -> Result { let entries = list.iter().map(|x| Path::new(x).to_path_buf()).collect(); + let path = if let Some(p) = path { + p.to_path_buf() + } else { + env::current_dir().unwrap_or(Path::new("/").to_path_buf()) + }; Ok(Self { - path: env::current_dir().unwrap_or(Path::new("/").to_path_buf()), + path, entries, specs, })