From c95c3289f80e0596834d02e63d09178b744ccf86 Mon Sep 17 00:00:00 2001 From: FenrirWolf Date: Sun, 4 Mar 2018 22:21:50 -0700 Subject: Make std::path aware of archive prefixes (#61) --- ctr-std/src/sys/unix/path.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ctr-std/src/sys') diff --git a/ctr-std/src/sys/unix/path.rs b/ctr-std/src/sys/unix/path.rs index 395b8c1..d96473b 100644 --- a/ctr-std/src/sys/unix/path.rs +++ b/ctr-std/src/sys/unix/path.rs @@ -21,8 +21,16 @@ pub fn is_verbatim_sep(b: u8) -> bool { b == b'/' } -pub fn parse_prefix(_: &OsStr) -> Option { - None +pub fn parse_prefix(path: &OsStr) -> Option { + if let Some(path_str) = path.to_str() { + if let Some(i) = path_str.find(':') { + Some(Prefix::Verbatim(OsStr::new(&path_str[..i]))) + } else { + None + } + } else { + None + } } pub const MAIN_SEP_STR: &'static str = "/"; -- cgit v1.2.3