diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/redox/os.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index 309201352c4..e007e33258f 100644 --- a/src/libstd/sys/redox/os.rs +++ b/src/libstd/sys/redox/os.rs @@ -113,8 +113,18 @@ impl StdError for JoinPathsError { } pub fn current_exe() -> io::Result<PathBuf> { - use io::ErrorKind; - Err(io::Error::new(ErrorKind::Other, "Not yet implemented on redox")) + use fs::File; + + let mut file = File::open("sys:exe")?; + + let mut path = String::new(); + file.read_to_string(&mut path)?; + + if path.ends_with('\n') { + path.pop(); + } + + Ok(PathBuf::from(path)) } pub struct Env { |
