summaryrefslogtreecommitdiffstats
path: root/crates/printer/src/hyperlink.rs
diff options
context:
space:
mode:
authorNicolas Holzschuch <n.holzschuch@free.fr>2024-04-23 19:12:19 +0200
committerGitHub <noreply@github.com>2024-04-23 13:12:19 -0400
commitbb8601b2bafb5e68181cbbb84e6ffa4f7a72bf16 (patch)
tree0d516a06c869e56b8324bed5f55af905dd1246f4 /crates/printer/src/hyperlink.rs
parent02b47b7469ac8fc9e7dcb390415644f33e500b72 (diff)
printer: make compilation on non-unix, non-windows platforms work
Some of the new hyperlink work caused ripgrep to stop compiling on non-{Unix,Windows} platforms. The most popular of which is WASI. This commit makes non-{Unix,Windows} compile again. And we add a very basic WASI test in CI to catch regressions. More work is needed to make tests on non-{Unix,Windows} platforms work. And of course, this commit specifically takes the path of disabling hyperlink support for non-{Unix,Windows} platforms.
Diffstat (limited to 'crates/printer/src/hyperlink.rs')
-rw-r--r--crates/printer/src/hyperlink.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/printer/src/hyperlink.rs b/crates/printer/src/hyperlink.rs
index 279258c1..ec1fd921 100644
--- a/crates/printer/src/hyperlink.rs
+++ b/crates/printer/src/hyperlink.rs
@@ -811,6 +811,13 @@ impl HyperlinkPath {
Some(HyperlinkPath::encode(with_slash.as_bytes()))
}
+ /// For other platforms (not windows, not unix), return None and log a debug message.
+ #[cfg(not(any(windows, unix)))]
+ pub(crate) fn from_path(original_path: &Path) -> Option<HyperlinkPath> {
+ log::debug!("hyperlinks are not supported on this platform");
+ None
+ }
+
/// Percent-encodes a path.
///
/// The alphanumeric ASCII characters and "-", ".", "_", "~" are unreserved