Utils: inlines ffIsAbsolutePath

This commit is contained in:
Carter Li
2025-11-25 10:32:42 +08:00
parent 9a74e6d7bc
commit 37639c3582
2 changed files with 9 additions and 11 deletions
-10
View File
@@ -64,13 +64,3 @@ const char* ffFindExecutableInPath(const char* name, FFstrbuf* result)
return NULL;
}
#endif
bool ffIsAbsolutePath(const char* path)
{
#ifdef _WIN32
return (ffCharIsEnglishAlphabet(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) // drive letter path
|| (path[0] == '\\' && path[1] == '\\'); // UNC path
#else
return path[0] == '/';
#endif
}
+9 -1
View File
@@ -3,4 +3,12 @@
#include "fastfetch.h"
const char* ffFindExecutableInPath(const char* name, FFstrbuf* result);
bool ffIsAbsolutePath(const char* path);
static inline bool ffIsAbsolutePath(const char* path)
{
#ifdef _WIN32
return (ffCharIsEnglishAlphabet(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) // drive letter path
|| (path[0] == '\\' && path[1] == '\\'); // UNC path
#else
return path[0] == '/';
#endif
}