Add path-absolutize crate for absolute path conversion
This commit is contained in:
parent
8b6fc24759
commit
30bfdaf0a6
|
@ -18,6 +18,7 @@ derive_more = { version = "0.99.17", default-features = false, features = ["dere
|
||||||
enum-as-inner = "0.6.0"
|
enum-as-inner = "0.6.0"
|
||||||
getset = "0.1.2"
|
getset = "0.1.2"
|
||||||
mlua = { version = "0.9.7", features = ["lua54", "vendored"], optional = true }
|
mlua = { version = "0.9.7", features = ["lua54", "vendored"], optional = true }
|
||||||
|
path-absolutize = "3.1.1"
|
||||||
serde = { version = "1.0.197", features = ["derive", "rc"], optional = true }
|
serde = { version = "1.0.197", features = ["derive", "rc"], optional = true }
|
||||||
shulkerbox = { path = "../shulkerbox", optional = true}
|
shulkerbox = { path = "../shulkerbox", optional = true}
|
||||||
strum = { version = "0.26.2", features = ["derive"] }
|
strum = { version = "0.26.2", features = ["derive"] }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! Module containing structures and implementations for logging messages to the user.
|
//! Module containing structures and implementations for logging messages to the user.
|
||||||
|
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
use path_absolutize::Absolutize;
|
||||||
use std::{fmt::Display, sync::Arc};
|
use std::{fmt::Display, sync::Arc};
|
||||||
|
|
||||||
use super::source_file::{Location, SourceFile, Span};
|
use super::source_file::{Location, SourceFile, Span};
|
||||||
|
@ -99,7 +100,12 @@ impl<'a, T: std::fmt::Display> Display for SourceCodeDisplay<'a, T> {
|
||||||
"-->".cyan().bold(),
|
"-->".cyan().bold(),
|
||||||
format_args!(
|
format_args!(
|
||||||
"{}:{}:{}",
|
"{}:{}:{}",
|
||||||
self.span.source_file().path().display(),
|
self.span
|
||||||
|
.source_file()
|
||||||
|
.path()
|
||||||
|
.absolutize()
|
||||||
|
.unwrap_or_else(|_| std::borrow::Cow::Borrowed(self.span.source_file().path()))
|
||||||
|
.display(),
|
||||||
start_location.line,
|
start_location.line,
|
||||||
start_location.column
|
start_location.column
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue