pwd builting and pwd variable fix
This commit is contained in:
parent
53fad8431c
commit
c967591855
|
@ -64,15 +64,14 @@ fn main(){
|
|||
println!();
|
||||
},
|
||||
"cd" => {
|
||||
// default to '/' as new directory if one was not provided
|
||||
let new_dir = args.peekable().peek().map_or(home_dir.clone(), |x| (*x).to_string());
|
||||
let root = Path::new(&new_dir);
|
||||
pwd=root.clone().to_path_buf();
|
||||
if let Err(e) = env::set_current_dir(&root) {
|
||||
eprintln!("{}", e);
|
||||
}
|
||||
|
||||
previous_command = None;
|
||||
pwd=env::current_dir().unwrap();
|
||||
},
|
||||
"pwd" => {
|
||||
println!("{}", pwd.display());
|
||||
|
|
Loading…
Reference in New Issue