From 924cdbdff8c7abd374bbe8fc2e67e548f41ddf70 Mon Sep 17 00:00:00 2001 From: Nora Date: Wed, 19 Jun 2019 23:17:31 +0200 Subject: improve path handling in khline --- src/khline.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/khline.rs b/src/khline.rs index e3397e8..7d70e9e 100644 --- a/src/khline.rs +++ b/src/khline.rs @@ -113,12 +113,11 @@ impl FromStr for KhLine { } fn to_filepath_checked(path_str: &str) -> Result { - let path = PathBuf::from(path_str); - if defaults::get_caldir().join(path.clone()).is_file() { + if defaults::get_caldir().join(&path).is_file() { Ok(path) } else { - Err("path is not a file".to_string()) + Err(format!("path {} is not a file", path_str)) } } -- cgit v1.2.3