Add current_exe support
This commit is contained in:
parent
18bf0540bf
commit
de68aced95
1 changed files with 12 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue