Editor: fix bug of executable searching

This commit is contained in:
李通洲
2024-08-23 10:17:06 +08:00
parent b4aac9d7d7
commit e199a2fb79
2 changed files with 27 additions and 18 deletions
+10 -7
View File
@@ -13,14 +13,17 @@ const char* ffFindExecutableInPath(const char* name, FFstrbuf* result)
const bool appendExe = !ffStrEndsWithIgnCase(name, ".exe");
#endif
for (char* token = NULL; (token = strchr(path,
#ifdef _WIN32
';'
#else
':'
#endif
)) != NULL; path = token + 1)
for (char* token = path; *token; path = token + 1)
{
token = strchr(path,
#ifdef _WIN32
';'
#else
':'
#endif
);
if (!token) token = path + strlen(path);
ffStrbufSetNS(result, (uint32_t)(token - path), path);
ffStrbufEnsureEndsWithC(result,
#ifdef _WIN32