Skip to content

Commit 3c6161f

Browse files
authored
Rollup merge of rust-lang#138457 - bjorn3:redox_scheme_paths, r=Noratrieb
Remove usage of legacy scheme paths on RedoxOS The `name:/path` path syntax is getting phased out[^1] in favor of `/scheme/name/path`. Also using `null:` is no longer necessary as `/dev/null` is available on Redox OS too. [^1]: https://gitlab.redox-os.org/redox-os/rfcs/-/blob/master/text/0006-scheme-path.md cc `@jackpot51`
2 parents 8c12431 + ad95c16 commit 3c6161f

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

std/src/path.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,6 @@ where
294294
}
295295
}
296296

297-
// Detect scheme on Redox
298-
pub(crate) fn has_redox_scheme(s: &[u8]) -> bool {
299-
cfg!(target_os = "redox") && s.contains(&b':')
300-
}
301-
302297
////////////////////////////////////////////////////////////////////////////////
303298
// Cross-platform, iterator-independent parsing
304299
////////////////////////////////////////////////////////////////////////////////
@@ -2834,8 +2829,7 @@ impl Path {
28342829
Components {
28352830
path: self.as_u8_slice(),
28362831
prefix,
2837-
has_physical_root: has_physical_root(self.as_u8_slice(), prefix)
2838-
|| has_redox_scheme(self.as_u8_slice()),
2832+
has_physical_root: has_physical_root(self.as_u8_slice(), prefix),
28392833
front: State::Prefix,
28402834
back: State::Body,
28412835
}

std/src/sys/pal/unix/os.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,12 @@ pub fn current_exe() -> io::Result<PathBuf> {
484484
}
485485
}
486486

487-
#[cfg(any(target_os = "redox", target_os = "rtems"))]
487+
#[cfg(target_os = "redox")]
488+
pub fn current_exe() -> io::Result<PathBuf> {
489+
crate::fs::read_to_string("/scheme/sys/exe").map(PathBuf::from)
490+
}
491+
492+
#[cfg(target_os = "rtems")]
488493
pub fn current_exe() -> io::Result<PathBuf> {
489494
crate::fs::read_to_string("sys:exe").map(PathBuf::from)
490495
}

std/src/sys/pal/unix/process/process_common.rs

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ use crate::{fmt, io, ptr};
1919
cfg_if::cfg_if! {
2020
if #[cfg(target_os = "fuchsia")] {
2121
// fuchsia doesn't have /dev/null
22-
} else if #[cfg(target_os = "redox")] {
23-
const DEV_NULL: &CStr = c"null:";
2422
} else if #[cfg(target_os = "vxworks")] {
2523
const DEV_NULL: &CStr = c"/null";
2624
} else {

std/src/sys/path/unix.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> {
6262
}
6363

6464
pub(crate) fn is_absolute(path: &Path) -> bool {
65-
if cfg!(target_os = "redox") {
66-
// FIXME: Allow Redox prefixes
67-
path.has_root() || crate::path::has_redox_scheme(path.as_u8_slice())
68-
} else if cfg!(any(unix, target_os = "hermit", target_os = "wasi")) {
65+
if cfg!(any(unix, target_os = "hermit", target_os = "wasi")) {
6966
path.has_root()
7067
} else {
7168
path.has_root() && path.prefix().is_some()

0 commit comments

Comments
 (0)