0.3.6 - Accept AsRef<Path> for disk path arguments

parent 39e8b8fa
Pipeline #5142 passed with stages
in 3 minutes and 9 seconds
......@@ -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)",
......
......@@ -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>"]
......
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 {
......
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment