diff options
| author | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
|---|---|---|
| committer | sumuel <samuel@yakubos.org> | 2026-08-17 20:44:55 +0000 |
| commit | 76424950e373d3b04ac3dd13019151bfba3e8423 (patch) | |
| tree | 4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/path.h | |
Add the files
Diffstat (limited to 'src/common/path.h')
| -rw-r--r-- | src/common/path.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/common/path.h b/src/common/path.h new file mode 100644 index 0000000..705b1c0 --- /dev/null +++ b/src/common/path.h @@ -0,0 +1,21 @@ +#pragma once + +#include "common/FFstrbuf.h" +#include "common/strutil.h" + +const char* ffFindExecutableInPath(const char* name, FFstrbuf* result); +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 +} + +#if _WIN32 +char* frealpath(void* __restrict hFile, char* __restrict resolved_name /*MAX_PATH*/); +char* realpath(const char* __restrict file_name, char* __restrict resolved_name /*MAX_PATH*/); +ssize_t freadlink(void* hFile, char* buf, size_t bufsiz); +ssize_t readlink(const char* path, char* buf, size_t bufsiz); +#endif |