diff --git a/src/lib.rs b/src/lib.rs index 30293c3c..6a79cc1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -937,14 +937,16 @@ fn path_to_file_url_path(path: &Path) -> Result, ()> { #[cfg(windows)] fn path_to_file_url_path(path: &Path) -> Result, ()> { + use std::path::{Prefix, Component}; if !path.is_absolute() { return Err(()) } let mut components = path.components(); let disk = match components.next() { - Some(new_path::Component::Prefix { - parsed: new_path::Prefix::Disk(byte), .. - }) => byte, + Some(Component::Prefix(ref p)) => match p.kind() { + Prefix::Disk(byte) => byte, + _ => return Err(()), + }, // FIXME: do something with UNC and other prefixes? _ => return Err(()) @@ -954,7 +956,7 @@ fn path_to_file_url_path(path: &Path) -> Result, ()> { let mut path = vec![format!("{}:", disk as char)]; for component in components { - if component == new_path::Component::RootDir { continue } + if component == Component::RootDir { continue } // FIXME: somehow work with non-unicode? let part = match component.as_os_str().to_str() { Some(s) => s,