Skip to content

Commit 97e15c0

Browse files
committed
Merge pull request #89 from alexcrichton/update
Fix windows build
2 parents 3014439 + baef35d commit 97e15c0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,14 +937,16 @@ fn path_to_file_url_path(path: &Path) -> Result<Vec<String>, ()> {
937937

938938
#[cfg(windows)]
939939
fn path_to_file_url_path(path: &Path) -> Result<Vec<String>, ()> {
940+
use std::path::{Prefix, Component};
940941
if !path.is_absolute() {
941942
return Err(())
942943
}
943944
let mut components = path.components();
944945
let disk = match components.next() {
945-
Some(new_path::Component::Prefix {
946-
parsed: new_path::Prefix::Disk(byte), ..
947-
}) => byte,
946+
Some(Component::Prefix(ref p)) => match p.kind() {
947+
Prefix::Disk(byte) => byte,
948+
_ => return Err(()),
949+
},
948950

949951
// FIXME: do something with UNC and other prefixes?
950952
_ => return Err(())
@@ -954,7 +956,7 @@ fn path_to_file_url_path(path: &Path) -> Result<Vec<String>, ()> {
954956
let mut path = vec![format!("{}:", disk as char)];
955957

956958
for component in components {
957-
if component == new_path::Component::RootDir { continue }
959+
if component == Component::RootDir { continue }
958960
// FIXME: somehow work with non-unicode?
959961
let part = match component.as_os_str().to_str() {
960962
Some(s) => s,

0 commit comments

Comments
 (0)