Skip to content

Commit

Permalink
Fix absolute issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Feb 8, 2022
1 parent d59d32c commit 81cc3af
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3199,7 +3199,7 @@ impl Error for StripPrefixError {
/// # fn main() {}
/// ```
///
/// The paths is resolved using [POSIX semantics][posix-semantics] except that
/// The path is resolved using [POSIX semantics][posix-semantics] except that
/// it stops short of resolving symlinks. This means it will keep `..`
/// components and trailing slashes.
///
Expand Down Expand Up @@ -3231,7 +3231,7 @@ impl Error for StripPrefixError {
///
/// [posix-semantics]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13
/// [windows-path]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew
#[unstable(feature = "absolute_path", issue = "none")]
#[unstable(feature = "absolute_path", issue = "92750")]
pub fn absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
let path = path.as_ref();
if path.as_os_str().is_empty() {
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/sgx/path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ffi::OsStr;
use crate::io;
use crate::path::{Path, PathBuf, Prefix};
use crate::sys::unsupported;

Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/solid/path.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ffi::OsStr;
use crate::io;
use crate::path::{Path, PathBuf, Prefix};
use crate::sys::unsupported;

Expand Down
3 changes: 1 addition & 2 deletions library/std/src/sys/unix/path.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::env;
use crate::ffi::OsStr;
use crate::io;
use crate::os::unix::ffi::OsStrExt;
use crate::path::{Path, PathBuf, Prefix};

#[inline]
Expand Down Expand Up @@ -30,7 +29,7 @@ pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> {
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13

let mut components = path.components();
let path_os = path.as_os_str().as_bytes();
let path_os = path.as_os_str().bytes();

let mut normalized = if path.is_absolute() {
// "If a pathname begins with two successive <slash> characters, the
Expand Down

0 comments on commit 81cc3af

Please sign in to comment.