@@ -1935,6 +1935,7 @@ impl Url {
1935
1935
/// # run().unwrap();
1936
1936
/// # }
1937
1937
/// ```
1938
+ #[ cfg( any( unix, windows, target_os="redox" ) ) ]
1938
1939
pub fn from_file_path < P : AsRef < Path > > ( path : P ) -> Result < Url , ( ) > {
1939
1940
let mut serialization = "file://" . to_owned ( ) ;
1940
1941
let host_start = serialization. len ( ) as u32 ;
@@ -1970,6 +1971,7 @@ impl Url {
1970
1971
///
1971
1972
/// Note that `std::path` does not consider trailing slashes significant
1972
1973
/// and usually does not include them (e.g. in `Path::parent()`).
1974
+ #[ cfg( any( unix, windows, target_os="redox" ) ) ]
1973
1975
pub fn from_directory_path < P : AsRef < Path > > ( path : P ) -> Result < Url , ( ) > {
1974
1976
let mut url = Url :: from_file_path ( path) ?;
1975
1977
if !url. serialization . ends_with ( '/' ) {
@@ -2051,6 +2053,7 @@ impl Url {
2051
2053
/// (That is, if the percent-decoded path contains a NUL byte or,
2052
2054
/// for a Windows path, is not UTF-8.)
2053
2055
#[ inline]
2056
+ #[ cfg( any( unix, windows, target_os="redox" ) ) ]
2054
2057
pub fn to_file_path ( & self ) -> Result < PathBuf , ( ) > {
2055
2058
if let Some ( segments) = self . path_segments ( ) {
2056
2059
let host = match self . host ( ) {
@@ -2297,6 +2300,7 @@ fn path_to_file_url_segments_windows(path: &Path, serialization: &mut String)
2297
2300
Ok ( ( host_end, host_internal) )
2298
2301
}
2299
2302
2303
+
2300
2304
#[ cfg( any( unix, target_os = "redox" ) ) ]
2301
2305
fn file_url_segments_to_pathbuf ( host : Option < & str > , segments : str:: Split < char > ) -> Result < PathBuf , ( ) > {
2302
2306
use std:: ffi:: OsStr ;
0 commit comments