1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 08:35:09 +00:00

Shell: update cached_path when adding aliases

This has the nice side effect of fixing alias completion, because
cached_path is the source of truth for the completion system, and it was
only refreshed (with shell::cache_path()) in the shell's constructor,
before the rc files where loaded (ie no aliases)

This also means that shell::is_runnable can now rely on the cache, and
doesn't have to check the aliases itself.
This commit is contained in:
Mathieu PATUREL 2020-08-03 10:05:10 +10:00 committed by Andreas Kling
parent 2b4b9d212e
commit f6d4c4f02c
2 changed files with 14 additions and 5 deletions

View file

@ -388,11 +388,6 @@ String Shell::resolve_alias(const String& name) const
bool Shell::is_runnable(const StringView& name)
{
// FIXME: for now, check aliases manually because cached path doesn't get
// updated with aliases. Should it?
if (!resolve_alias(name).is_null())
return true;
if (access(name.to_string().characters(), X_OK) == 0)
return true;