mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +00:00
Shell: Fix how cd handles the path argument
Previously this didn't work: $ cd -- /usr Invalid path '--' This path fixes this issue and removes the unnecessary else branch because we're already using realpath() later on to resolve relative paths.
This commit is contained in:
parent
6a957daba4
commit
1e5a7ca0a7
1 changed files with 1 additions and 7 deletions
|
@ -198,14 +198,8 @@ int Shell::builtin_cd(int argc, const char** argv)
|
|||
if (oldpwd == nullptr)
|
||||
return 1;
|
||||
new_path = oldpwd;
|
||||
} else if (arg_path[0] == '/') {
|
||||
new_path = argv[1];
|
||||
} else {
|
||||
StringBuilder builder;
|
||||
builder.append(cwd);
|
||||
builder.append('/');
|
||||
builder.append(arg_path);
|
||||
new_path = builder.to_string();
|
||||
new_path = arg_path;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue