Skip to content

Commit 82f1b28

Browse files
committed
Remove file-related methods on all except unix, windows, redox
1 parent c6e419f commit 82f1b28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,7 @@ impl Url {
19351935
/// # run().unwrap();
19361936
/// # }
19371937
/// ```
1938+
#[cfg(any(unix, windows, target_os="redox"))]
19381939
pub fn from_file_path<P: AsRef<Path>>(path: P) -> Result<Url, ()> {
19391940
let mut serialization = "file://".to_owned();
19401941
let host_start = serialization.len() as u32;
@@ -1970,6 +1971,7 @@ impl Url {
19701971
///
19711972
/// Note that `std::path` does not consider trailing slashes significant
19721973
/// and usually does not include them (e.g. in `Path::parent()`).
1974+
#[cfg(any(unix, windows, target_os="redox"))]
19731975
pub fn from_directory_path<P: AsRef<Path>>(path: P) -> Result<Url, ()> {
19741976
let mut url = Url::from_file_path(path)?;
19751977
if !url.serialization.ends_with('/') {
@@ -2051,6 +2053,7 @@ impl Url {
20512053
/// (That is, if the percent-decoded path contains a NUL byte or,
20522054
/// for a Windows path, is not UTF-8.)
20532055
#[inline]
2056+
#[cfg(any(unix, windows, target_os="redox"))]
20542057
pub fn to_file_path(&self) -> Result<PathBuf, ()> {
20552058
if let Some(segments) = self.path_segments() {
20562059
let host = match self.host() {
@@ -2297,6 +2300,7 @@ fn path_to_file_url_segments_windows(path: &Path, serialization: &mut String)
22972300
Ok((host_end, host_internal))
22982301
}
22992302

2303+
23002304
#[cfg(any(unix, target_os = "redox"))]
23012305
fn file_url_segments_to_pathbuf(host: Option<&str>, segments: str::Split<char>) -> Result<PathBuf, ()> {
23022306
use std::ffi::OsStr;

0 commit comments

Comments
 (0)