Fix 'Segments::to_path_buf()' on Windows.

This commit is contained in:
Sergio Benitez 2022-04-19 13:06:02 -07:00
parent 82cd53de36
commit 2a7eac01bb
1 changed files with 4 additions and 6 deletions

View File

@ -215,12 +215,10 @@ impl<'a> Segments<'a, Path> {
return Err(PathError::BadEnd('<'))
} else if segment.contains('/') {
return Err(PathError::BadChar('/'))
} else if cfg!(windows) {
if segment.contains('\\') {
return Err(PathError::BadChar('\\'))
} else if segment.contains(':') {
return Err(PathError::BadChar(':'))
}
} else if cfg!(windows) && segment.contains('\\') {
return Err(PathError::BadChar('\\'))
} else if cfg!(windows) && segment.contains(':') {
return Err(PathError::BadChar(':'))
} else {
buf.push(&*segment)
}