mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Processing (Haiku): fix exe detection
This commit is contained in:
parent
95a44d3a33
commit
1137e8d1c9
@ -315,39 +315,17 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
{
|
||||
team_info info;
|
||||
if (get_team_info(pid, &info) == B_OK)
|
||||
{
|
||||
// This is tricky. Paths in info.args are not quoted, so that we don't know
|
||||
// if a whitespace in args is part of the file path or an argument separator
|
||||
if (info.argc == 1)
|
||||
ffStrbufSetS(exe, info.args);
|
||||
else
|
||||
{
|
||||
// args = "/bin/bash -l"
|
||||
// argc = 2
|
||||
int argc = info.argc - 1;
|
||||
const char* arg0End = strchr(info.args, ' ');
|
||||
for (const char* p = arg0End + 1; (p = strchr(p, ' ')); ++p)
|
||||
--argc;
|
||||
if (argc == 1) // No whitespace in the file path
|
||||
ffStrbufSetNS(exe, (uint32_t) (arg0End - info.args), info.args);
|
||||
}
|
||||
}
|
||||
}
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
|
||||
if (exePath)
|
||||
while (get_next_image_info(pid, &cookie, &info) == B_OK)
|
||||
{
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
if (info.type != B_APP_IMAGE) continue;
|
||||
ffStrbufSetS(exe, info.name);
|
||||
|
||||
while (get_next_image_info(pid, &cookie, &info) == B_OK)
|
||||
{
|
||||
if (info.type != B_APP_IMAGE) continue;
|
||||
ffStrbufSetS(exePath, info.name);
|
||||
break;
|
||||
}
|
||||
if (exePath)
|
||||
ffStrbufSet(exePath, exe);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user