Skip to content

Commit 8b18ef9

Browse files
committed
Add Redox scheme prefix
1 parent 5230979 commit 8b18ef9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/libstd/path.rs

+5
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ pub enum Prefix<'a> {
191191
/// Prefix `C:` for the given disk drive.
192192
#[stable(feature = "rust1", since = "1.0.0")]
193193
Disk(#[stable(feature = "rust1", since = "1.0.0")] u8),
194+
195+
/// Scheme `file:` used on Redox
196+
#[stable(feature = "rust1", since = "1.0.0")]
197+
Scheme(#[stable(feature = "rust1", since = "1.0.0")] &'a OsStr),
194198
}
195199

196200
impl<'a> Prefix<'a> {
@@ -221,6 +225,7 @@ impl<'a> Prefix<'a> {
221225
},
222226
DeviceNS(x) => 4 + os_str_len(x),
223227
Disk(_) => 2,
228+
Scheme(x) => 1 + os_str_len(x),
224229
}
225230

226231
}

src/libstd/sys/redox/path.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ pub fn is_verbatim_sep(b: u8) -> bool {
2323

2424
pub fn parse_prefix(path: &OsStr) -> Option<Prefix> {
2525
if let Some(path_str) = path.to_str() {
26-
if let Some(_i) = path_str.find(':') {
26+
if let Some(i) = path_str.find(':') {
2727
// FIXME: Redox specific prefix
28-
// Some(Prefix::Verbatim(OsStr::new(&path_str[..i])))
29-
None
28+
Some(Prefix::Scheme(OsStr::new(&path_str[..i])))
3029
} else {
3130
None
3231
}

0 commit comments

Comments
 (0)