diff --git a/examples/get.rs b/examples/get.rs index f9a6994..52d7ea7 100644 --- a/examples/get.rs +++ b/examples/get.rs @@ -8,7 +8,7 @@ /// /// NOTE: running this program with `cargo run --example get` will create and delete the file /// `example-readme.md` in the current directory. -use std::path::{Path, PathBuf}; +use std::path::Path; #[tokio::main] async fn main() -> kxio::Result<()> { @@ -18,7 +18,7 @@ async fn main() -> kxio::Result<()> { // Create a `FileSystem` object for accessing files within the current directory. // The object created will return a `PathTraveral` error result if there is an attempt to\ // access a file outside of this directory. - let fs: kxio::fs::FileSystem = kxio::fs::new(PathBuf::from("./")); + let fs: kxio::fs::FileSystem = kxio::fs::new("./"); // The URL we will fetch - the readme for this library. let url = "https://git.kemitix.net/kemitix/kxio/raw/branch/main/README.md"; diff --git a/src/fs/mod.rs b/src/fs/mod.rs index 1a8c9a8..ddb2f02 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -3,7 +3,7 @@ //! Create a new `FileSystem` to access a directory using `kxio::fs::new(path)`. //! Create a new `TempFileSystem` to access a temporary directory using `kxio::fs::temp()?`; //! -//! `TempFileSystem` derefs automaticalyl to `FileSystem` so can be used anywhere +//! `TempFileSystem` derefs automatically to `FileSystem` so can be used anywhere //! you would use `FileSystem`. //! //! ``` @@ -81,8 +81,8 @@ pub use system::{DirHandle, FileHandle, FileSystem, PathHandle}; /// Any attempt to access outside this base will result in a /// `error::Error::PathTraversal` error when attempting the /// opertation. -pub const fn new(base: PathBuf) -> FileSystem { - FileSystem::new(base) +pub fn new(base: impl Into) -> FileSystem { + FileSystem::new(base.into()) } /// Creates a new `TempFileSystem` for a temporary directory.