diff --git a/Cargo.lock b/Cargo.lock index 18b5dfba1ba48605ce67902725d396371de918b9..283d24e1b6f888b496357f83b1ebf1c04cc42317 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,7 +97,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redoxfs" -version = "0.3.5" +version = "0.3.6" dependencies = [ "fuse 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index e5f2535f8c3dc93a78ff826ca0a48cc5567ee4a6..7eb60f40968e96eef3e01cc11bdcc6fd1ec24d75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "redoxfs" description = "The Redox Filesystem" repository = "https://gitlab.redox-os.org/redox-os/redoxfs" -version = "0.3.5" +version = "0.3.6" license-file = "LICENSE" readme = "README.md" authors = ["Jeremy Soller <jackpot51@gmail.com>"] diff --git a/src/disk/file.rs b/src/disk/file.rs index de1a6fbe9611e75adf3e2e531f0889dd135687ca..d36e012c70c4d0a2381e9d0801c91f44eba2c429 100644 --- a/src/disk/file.rs +++ b/src/disk/file.rs @@ -1,5 +1,6 @@ use std::fs::{File, OpenOptions}; use std::io::{Read, Write, Seek, SeekFrom}; +use std::path::Path; use syscall::error::{Error, Result, EIO}; use BLOCK_SIZE; @@ -20,14 +21,14 @@ pub struct DiskFile { } impl DiskFile { - pub fn open(path: &str) -> Result<DiskFile> { + pub fn open<P: AsRef<Path>>(path: P) -> Result<DiskFile> { let file = try_disk!(OpenOptions::new().read(true).write(true).open(path)); Ok(DiskFile { file: file }) } - pub fn create(path: &str, size: u64) -> Result<DiskFile> { + pub fn create<P: AsRef<Path>>(path: P, size: u64) -> Result<DiskFile> { let file = try_disk!(OpenOptions::new().read(true).write(true).create(true).open(path)); try_disk!(file.set_len(size)); Ok(DiskFile { diff --git a/src/disk/sparse.rs b/src/disk/sparse.rs index dd7d7992cb2a49b9f55556cb2cc50bb28158daf3..da31f06f32b912d2c45535b593b0dac4eaf57b2a 100644 --- a/src/disk/sparse.rs +++ b/src/disk/sparse.rs @@ -1,5 +1,6 @@ use std::fs::{File, OpenOptions}; use std::io::{Read, Write, Seek, SeekFrom}; +use std::path::Path; use std::u64; use syscall::error::{Error, Result, EIO}; @@ -21,7 +22,7 @@ pub struct DiskSparse { } impl DiskSparse { - pub fn create(path: &str) -> Result<DiskSparse> { + pub fn create<P: AsRef<Path>>(path: P) -> Result<DiskSparse> { let file = try_disk!(OpenOptions::new().read(true).write(true).create(true).open(path)); Ok(DiskSparse { file