Function git_path::to_windows_separators
source · Expand description
Find backslashes and replace them with slashes, which typically resembles a unix path, unconditionally.
Note Do not use these and prefer the conditional versions of this method.
Examples found in repository?
src/convert.rs (line 185)
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
pub fn to_native_separators<'a>(path: impl Into<Cow<'a, BStr>>) -> Cow<'a, BStr> {
#[cfg(not(windows))]
let p = to_unix_separators(path);
#[cfg(windows)]
let p = to_windows_separators(path);
p
}
/// Convert paths with slashes to backslashes on windows and do nothing on unix, but **panics** if malformed surrogates are encountered on windows.
pub fn to_native_path_on_windows<'a>(path: impl Into<Cow<'a, BStr>>) -> Cow<'a, std::path::Path> {
#[cfg(not(windows))]
{
crate::from_bstr(path)
}
#[cfg(windows)]
{
crate::from_bstr(to_windows_separators(path))
}
}