xtask/extendrtests/path_helper.rs
1use std::path::Path;
2
3pub(crate) trait RCompatiblePath
4where
5 Self: AsRef<Path>,
6{
7 fn adjust_for_r(&self) -> String {
8 let path = self.as_ref().to_string_lossy();
9 if cfg!(target_os = "windows") && path.starts_with(r"\\?\") {
10 path[4..].replace('\\', "/")
11 } else {
12 path.to_string()
13 }
14 }
15}
16
17impl<T> RCompatiblePath for T where T: AsRef<Path> {}