Add current_exe support

This commit is contained in:
Jeremy Soller 2016-11-14 19:08:48 -07:00
parent 18bf0540bf
commit de68aced95

View file

@ -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 {