diff options
Diffstat (limited to 'ipfs-cli/src/command/mod.rs')
-rw-r--r-- | ipfs-cli/src/command/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ipfs-cli/src/command/mod.rs b/ipfs-cli/src/command/mod.rs index 3f6d4b3..969f872 100644 --- a/ipfs-cli/src/command/mod.rs +++ b/ipfs-cli/src/command/mod.rs @@ -6,6 +6,7 @@ // copied, modified, or distributed except according to those terms. // +use std::path::Path; use clap::{App, ArgMatches}; use futures::Future; use ipfs_api::IpfsClient; @@ -18,7 +19,7 @@ pub const EXPECTED_FILE: &str = "expected to read input file"; /// Verifies that a path points to a file that exists, and not a directory. /// -pub fn verify_file(path: String) -> Result<(), String> { +pub fn verify_file<P>(path: P) -> Result<(), String> where P: AsRef<Path> { match fs::metadata(path) { Ok(ref metadata) if metadata.is_file() => Ok(()), Ok(_) => Err("file must not be a directory".into()), |