mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Fix path hash bug on unix
This commit is contained in:
parent
37e0846037
commit
9bdb0bdeff
@ -195,8 +195,13 @@ fn load(cache: &mut FileCache, path: &Path) -> Option<Buffer> {
|
|||||||
/// Create a hash that is the same for all paths pointing to the same file.
|
/// Create a hash that is the same for all paths pointing to the same file.
|
||||||
fn hash(path: &Path) -> Option<FileHash> {
|
fn hash(path: &Path) -> Option<FileHash> {
|
||||||
let file = File::open(path).ok()?;
|
let file = File::open(path).ok()?;
|
||||||
|
let meta = file.metadata().ok()?;
|
||||||
|
if meta.is_file() {
|
||||||
let handle = Handle::from_file(file).ok()?;
|
let handle = Handle::from_file(file).ok()?;
|
||||||
Some(FileHash(fxhash::hash64(&handle)))
|
Some(FileHash(fxhash::hash64(&handle)))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user