mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
Userland: Rely on a single authoritative source for the default PATH
This commit is contained in:
parent
61e18c681b
commit
39a3775f48
7 changed files with 14 additions and 7 deletions
|
@ -958,7 +958,7 @@ ErrorOr<String> find_file_in_path(StringView filename)
|
|||
auto const* path_ptr = getenv("PATH");
|
||||
StringView path { path_ptr, strlen(path_ptr) };
|
||||
if (path.is_empty())
|
||||
path = "/bin:/usr/bin"sv;
|
||||
path = DEFAULT_PATH_SV;
|
||||
auto parts = path.split_view(':');
|
||||
for (auto& part : parts) {
|
||||
auto candidate = String::formatted("{}/{}", part, filename);
|
||||
|
@ -1043,7 +1043,7 @@ ErrorOr<void> exec(StringView filename, Span<StringView> arguments, SearchInPath
|
|||
ScopedValueRollback errno_rollback(errno);
|
||||
String path = getenv("PATH");
|
||||
if (path.is_empty())
|
||||
path = "/bin:/usr/bin";
|
||||
path = DEFAULT_PATH;
|
||||
auto parts = path.split(':');
|
||||
for (auto& part : parts) {
|
||||
auto candidate = String::formatted("{}/{}", part, filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue