perf: find path efficiently for clangd argus, close #765.#780
Conversation
Signed-off-by: ayamir <lgt986452565@gmail.com>
|
I'm not sure if this will work or not, especially we will have sunchangtan and Groveer can test the patch first. |
Test passed on my windows PC, but need more tests to confirm. |
I test passed. it works good. |
Jint-lzxy
left a comment
There was a problem hiding this comment.
Also works on my Windows 10 VM :) In fact, checking fs.c - $PATH is correctly resolved:
static bool is_executable_in_path(const char *name, char **abspath)
FUNC_ATTR_NONNULL_ARG(1)
{
const char *path_env = os_getenv("PATH");
// ...... //
size_t buf_len = strlen(name) + strlen(path) + 2;
char *buf = xmalloc(buf_len);
// ...... //
while (true) {
char *e = xstrchrnul(p, ENV_SEPCHAR);
// Combine the $PATH segment with `name`.
xstrlcpy(buf, p, (size_t)(e - p) + 1);
append_path(buf, name, buf_len);
#ifdef MSWIN
if (is_executable_ext(buf, abspath)) {
#else
// ...... //
#endif
rv = true;
goto end;
}
// ...... //
}
I test passed. it works good. |
…ir#780) Signed-off-by: ayamir <lgt986452565@gmail.com>
…ir#780) Signed-off-by: ayamir <lgt986452565@gmail.com>
…ir#780) Signed-off-by: ayamir <lgt986452565@gmail.com>
@sunchangtan @Groveer