mod File: absolute -> canonicalize

This commit is contained in:
Jörn-Michael Miehe 2025-06-02 13:32:34 +00:00
parent 256f3ce8ba
commit fc38e51a03

View file

@ -2,10 +2,10 @@ mod chunks;
use std::{ use std::{
ffi::OsStr, ffi::OsStr,
fs::metadata, fs::{canonicalize, metadata},
hash::{Hash, Hasher}, hash::{Hash, Hasher},
io::{self, ErrorKind}, io::{self, ErrorKind},
path::{Path, PathBuf, absolute}, path::{Path, PathBuf},
}; };
use log::{debug, error}; use log::{debug, error};
@ -33,7 +33,7 @@ impl Hash for File {
impl File { impl File {
pub fn new(path: impl AsRef<Path>) -> io::Result<Self> { pub fn new(path: impl AsRef<Path>) -> io::Result<Self> {
let abs_path = absolute(path)?; let abs_path = canonicalize(path)?;
let m = metadata(&abs_path)?; let m = metadata(&abs_path)?;
if !m.is_file() { if !m.is_file() {