Sync computers
This commit is contained in:
@@ -44,31 +44,29 @@ impl<'a, T> Dir<'a, T> {
|
||||
}
|
||||
}
|
||||
impl<'a, T: ReadSeek> Dir<'a, T> {
|
||||
pub fn open_entry<'b, P: Into<Path<'b>>>(
|
||||
pub fn open_entry<P: AsRef<Path>>(
|
||||
&self,
|
||||
path: P,
|
||||
) -> Result<DirEntry<'a, T>, Error<T::Error>> {
|
||||
let path = path.into();
|
||||
if path.is_absolute() {
|
||||
if path.as_ref().is_absolute() {
|
||||
return self.fs.open_entry(path);
|
||||
}
|
||||
for file in self.iter() {
|
||||
let f = file?;
|
||||
if f.name_is(path.as_str()) {
|
||||
if f.name_is(path.as_ref().as_str()) {
|
||||
return Ok(f);
|
||||
}
|
||||
}
|
||||
Err(Error::NotFound)
|
||||
}
|
||||
pub fn open_file<'b, P: Into<Path<'b>>>(
|
||||
pub fn open_file<P: AsRef<Path>>(
|
||||
&self,
|
||||
path: P,
|
||||
) -> Result<File<'a, T>, Error<T::Error>> {
|
||||
let path = path.into();
|
||||
if path.is_absolute() {
|
||||
if path.as_ref().is_absolute() {
|
||||
return self.fs.open_file(path);
|
||||
}
|
||||
let (start, dirname) = path.split_path();
|
||||
let (start, dirname) = path.as_ref().split_path();
|
||||
let entry = self.open_entry(start)?;
|
||||
match dirname {
|
||||
Some(name) => {
|
||||
@@ -85,8 +83,8 @@ impl<'a, T: ReadSeek> Dir<'a, T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn open_dir<'b, P: Into<Path<'b>>>(&self, path: P) -> Result<Self, Error<T::Error>> {
|
||||
let path = path.into();
|
||||
pub fn open_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self, Error<T::Error>> {
|
||||
let path = path.as_ref();
|
||||
if path.is_absolute() {
|
||||
return self.fs.open_dir(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user