diff --git a/src/main.rs b/src/main.rs index bb4c7fd4..110a249f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -262,8 +262,7 @@ fn list_files(tool: &dyn Tool, source: &Utf8Path, options: &Options, json: bool) .iter() .map(|source_file| { json!({ - // to_string so that we get it with slashes. - "path": source_file.tree_relative_path.to_string(), + "path": source_file.tree_relative_path.to_slash_path(), "package": source_file.package.name, }) }) @@ -273,7 +272,7 @@ fn list_files(tool: &dyn Tool, source: &Utf8Path, options: &Options, json: bool) writeln!(out)?; } else { for file in files { - writeln!(out, "{}", file.tree_relative_path)?; + writeln!(out, "{}", file.tree_relative_path.to_slash_path())?; } } Ok(()) diff --git a/src/source.rs b/src/source.rs index e2bf4bac..e69a9625 100644 --- a/src/source.rs +++ b/src/source.rs @@ -9,6 +9,8 @@ use camino::{Utf8Path, Utf8PathBuf}; #[allow(unused_imports)] use tracing::{debug, info, warn}; +use crate::path::Utf8PathSlashes; + /// A Rust source file within a source tree. /// /// It can be viewed either relative to the source tree (for display) @@ -50,7 +52,7 @@ impl SourceFile { /// Return the path of this file relative to the tree root, with forward slashes. pub fn tree_relative_slashes(&self) -> String { - self.tree_relative_path.to_string() + self.tree_relative_path.to_slash_path() } /// Return the path of this file relative to the base of the source tree.