mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 16:59:47 +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
Notes:
sideshowbarker
2024-07-18 19:12:15 +09:00
Author: https://github.com/gunnarbeutner
Commit: 1e5a7ca0a7
Pull-request: https://github.com/SerenityOS/serenity/pull/6544
Reviewed-by: https://github.com/emanuele6
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)
|
if (oldpwd == nullptr)
|
||||||
return 1;
|
return 1;
|
||||||
new_path = oldpwd;
|
new_path = oldpwd;
|
||||||
} else if (arg_path[0] == '/') {
|
|
||||||
new_path = argv[1];
|
|
||||||
} else {
|
} else {
|
||||||
StringBuilder builder;
|
new_path = arg_path;
|
||||||
builder.append(cwd);
|
|
||||||
builder.append('/');
|
|
||||||
builder.append(arg_path);
|
|
||||||
new_path = builder.to_string();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue