mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Fix error messages on Windows
This commit is contained in:
parent
20b990d297
commit
0dacb2d151
@ -121,10 +121,9 @@ impl Loader for FsLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn resolve(&self, path: &Path) -> io::Result<FileHash> {
|
fn resolve(&self, path: &Path) -> io::Result<FileHash> {
|
||||||
let file = File::open(path)?;
|
let meta = fs::metadata(path)?;
|
||||||
let meta = file.metadata()?;
|
|
||||||
if meta.is_file() {
|
if meta.is_file() {
|
||||||
let handle = Handle::from_file(file)?;
|
let handle = Handle::from_path(path)?;
|
||||||
Ok(FileHash(fxhash::hash64(&handle)))
|
Ok(FileHash(fxhash::hash64(&handle)))
|
||||||
} else {
|
} else {
|
||||||
Err(io::ErrorKind::NotFound.into())
|
Err(io::ErrorKind::NotFound.into())
|
||||||
|
@ -316,7 +316,11 @@ fn test_part(
|
|||||||
let mut errors: Vec<_> = errors
|
let mut errors: Vec<_> = errors
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|error| error.span.source() == id)
|
.filter(|error| error.span.source() == id)
|
||||||
.map(|error| (ctx.sources.range(error.span), error.message))
|
.map(|error| {
|
||||||
|
let range = ctx.sources.range(error.span);
|
||||||
|
let msg = error.message.replace("\\", "/");
|
||||||
|
(range, msg)
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
errors.sort_by_key(|error| error.0.start);
|
errors.sort_by_key(|error| error.0.start);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user