diff options
Diffstat (limited to 'libfuzzer/FuzzerIOWindows.cpp')
-rw-r--r-- | libfuzzer/FuzzerIOWindows.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libfuzzer/FuzzerIOWindows.cpp b/libfuzzer/FuzzerIOWindows.cpp index 651283a..61ad35e 100644 --- a/libfuzzer/FuzzerIOWindows.cpp +++ b/libfuzzer/FuzzerIOWindows.cpp @@ -76,6 +76,18 @@ static bool IsDir(DWORD FileAttrs) { return FileAttrs & FILE_ATTRIBUTE_DIRECTORY; } +bool IsDirectory(const std::string &Path) { + DWORD Att = GetFileAttributesA(Path.c_str()); + + if (Att == INVALID_FILE_ATTRIBUTES) { + Printf("GetFileAttributesA() failed for \"%s\" (Error code: %lu).\n", + Path.c_str(), GetLastError()); + return false; + } + + return IsDir(Att); +} + std::string Basename(const std::string &Path) { size_t Pos = Path.find_last_of("/\\"); if (Pos == std::string::npos) return Path; @@ -227,7 +239,7 @@ intptr_t GetHandleFromFd(int fd) { return _get_osfhandle(fd); } -static bool IsSeparator(char C) { +bool IsSeparator(char C) { return C == '\\' || C == '/'; } |