mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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: https://github.com/SerenityOS/serenity/commit/1e5a7ca0a7f Pull-request: https://github.com/SerenityOS/serenity/pull/6544 Reviewed-by: https://github.com/emanuele6
@ -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…
Reference in New Issue
Block a user