1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

Userland: Rely on a single authoritative source for the default PATH

This commit is contained in:
Tim Schumacher 2022-08-20 17:01:53 +02:00 committed by Linus Groh
parent 61e18c681b
commit 39a3775f48
7 changed files with 14 additions and 7 deletions

View file

@ -8,6 +8,7 @@
#include <AK/ScopedValueRollback.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/File.h>
#include <alloca.h>
#include <assert.h>
#include <bits/pthread_cancel.h>
@ -186,7 +187,7 @@ int execvpe(char const* filename, char* const argv[], char* const envp[])
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);