Util (Linux): fix executable file check

This commit is contained in:
李通洲
2025-04-01 16:27:11 +08:00
committed by 李通洲
parent 3d3669ae3a
commit 45aecae221
+3 -3
View File
@@ -38,8 +38,7 @@ const char* ffFindExecutableInPath(const char* name, FFstrbuf* result)
if (!ffPathExists(result->chars, FF_PATHTYPE_FILE))
continue;
#else
struct stat st;
if (stat(result->chars, &st) < 0 || !(st.st_mode & S_IXUSR))
if (access(result->chars, X_OK) != 0)
continue;
#endif
@@ -52,7 +51,8 @@ const char* ffFindExecutableInPath(const char* name, FFstrbuf* result)
bool ffIsAbsolutePath(const char* path)
{
#ifdef _WIN32
return ffCharIsEnglishAlphabet(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/');
return (ffCharIsEnglishAlphabet(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) // drive letter path
|| (path[0] == '\\' && path[1] == '\\'); // UNC path
#else
return path[0] == '/';
#endif