Skip to content

Commit

Permalink
fix #388
Browse files Browse the repository at this point in the history
  • Loading branch information
Akmadan23 authored Aug 2, 2023
1 parent 48e42e2 commit 7a34362
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/change_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ pub fn cd(path: &path::Path, context: &mut AppContext) -> std::io::Result<()> {
Ok(())
}

pub fn change_directory(context: &mut AppContext, path: &path::Path) -> JoshutoResult {
pub fn change_directory(context: &mut AppContext, mut path: &path::Path) -> JoshutoResult {
let new_cwd = if path.is_absolute() {
path.to_path_buf()
} else {
while let Ok(p) = path.strip_prefix("../") {
parent_directory(context)?;
path = p;
}

let mut new_cwd = std::env::current_dir()?;
new_cwd.push(path);
new_cwd
Expand Down

0 comments on commit 7a34362

Please sign in to comment.