diff options
author | rabite <rabite@posteo.de> | 2019-03-16 14:35:32 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-03-16 14:35:32 +0100 |
commit | 33a9562379b9d6fdd7be19ce20b3a5ac1fa7e1c7 (patch) | |
tree | ceb2a79a8cbc7e22430d8645527339f284d4dfc3 /src/files.rs | |
parent | 45203cff36eced24ce7a7c34bae386ad16ef9ca0 (diff) |
some error handling modifications
Diffstat (limited to 'src/files.rs')
-rw-r--r-- | src/files.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/files.rs b/src/files.rs index b151e39..e2a5aab 100644 --- a/src/files.rs +++ b/src/files.rs @@ -256,8 +256,7 @@ impl Files { if dir == path { Ok(true) } else { - Err(HError::WrongDirectoryError{path: path.into(), - dir: dir}) + HError::wrong_directory(path.into(), dir)? } } @@ -381,14 +380,14 @@ impl File { pub fn meta(&self) -> HResult<std::fs::Metadata> { match &self.meta { Some(meta) => Ok(meta.clone()), - None => { Ok(std::fs::metadata(&self.path)?) } + None => { Ok(std::fs::symlink_metadata(&self.path)?) } } } pub fn get_meta(&mut self) -> HResult<()> { if let Some(_) = self.meta { return Ok(()) } - let meta = std::fs::metadata(&self.path)?; + let meta = std::fs::symlink_metadata(&self.path)?; let color = self.get_color(&meta); self.meta = Some(meta); |