summaryrefslogtreecommitdiff
path: root/src/terminal_link.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal_link.rs')
-rw-r--r--src/terminal_link.rs26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/terminal_link.rs b/src/terminal_link.rs
deleted file mode 100644
index 9bea07d..0000000
--- a/src/terminal_link.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-use std::{
- fmt::{self, Display, Formatter},
- fs,
-};
-
-pub struct TerminalFileLink<'a>(pub &'a str);
-
-impl<'a> Display for TerminalFileLink<'a> {
- fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
- let path = fs::canonicalize(self.0);
-
- if let Some(path) = path.as_deref().ok().and_then(|path| path.to_str()) {
- // Windows itself can't handle its verbatim paths.
- #[cfg(windows)]
- let path = if path.len() > 5 && &path[0..4] == r"\\?\" {
- &path[4..]
- } else {
- path
- };
-
- write!(f, "\x1b]8;;file://{path}\x1b\\{}\x1b]8;;\x1b\\", self.0)
- } else {
- write!(f, "{}", self.0)
- }
- }
-}