Skip to content

Commit

Permalink
Move platform-specific implementation of libstd/path.rs
Browse files Browse the repository at this point in the history
This removes one exception in the tidy lint 'pal'.
  • Loading branch information
cassiersg committed Jan 26, 2017
1 parent 491b978 commit 5b8fe3e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ use ops::{self, Deref};

use ffi::{OsStr, OsString};

use sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix};
use sys::path::{ABSOLUTE_NEEDS_PREFIX, is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix};

////////////////////////////////////////////////////////////////////////////////
// GENERAL NOTES
Expand Down Expand Up @@ -1509,7 +1509,7 @@ impl Path {
#[allow(deprecated)]
pub fn is_absolute(&self) -> bool {
// FIXME: Remove target_os = "redox" and allow Redox prefixes
self.has_root() && (cfg!(unix) || cfg!(target_os = "redox") || self.prefix().is_some())
self.has_root() && (!ABSOLUTE_NEEDS_PREFIX || self.prefix().is_some())
}

/// A path is *relative* if it is not absolute.
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/sys/redox/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ pub fn parse_prefix(path: &OsStr) -> Option<Prefix> {

pub const MAIN_SEP_STR: &'static str = "/";
pub const MAIN_SEP: char = '/';
// FIXME: Change to 'true' and allow Redox prefixes
pub const ABSOLUTE_NEEDS_PREFIX: bool = false;
1 change: 1 addition & 0 deletions src/libstd/sys/unix/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {

pub const MAIN_SEP_STR: &'static str = "/";
pub const MAIN_SEP: char = '/';
pub const ABSOLUTE_NEEDS_PREFIX: bool = false;
1 change: 1 addition & 0 deletions src/libstd/sys/windows/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ pub fn parse_prefix<'a>(path: &'a OsStr) -> Option<Prefix> {

pub const MAIN_SEP_STR: &'static str = "\\";
pub const MAIN_SEP: char = '\\';
pub const ABSOLUTE_NEEDS_PREFIX: bool = true;
1 change: 0 additions & 1 deletion src/tools/tidy/src/pal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const EXCEPTION_PATHS: &'static [&'static str] = &[

// temporary exceptions
"src/libstd/rtdeps.rs", // Until rustbuild replaces make
"src/libstd/path.rs",
"src/libstd/f32.rs",
"src/libstd/f64.rs",
"src/libstd/sys_common/mod.rs",
Expand Down

0 comments on commit 5b8fe3e

Please sign in to comment.