diff --git a/include/nod/OSUTF.h b/include/nod/OSUTF.h index aad53e4..e50f28d 100644 --- a/include/nod/OSUTF.h +++ b/include/nod/OSUTF.h @@ -1,11 +1,15 @@ #ifdef __cplusplus -extern "C" { +#include + #define OS_CONSTEXPR constexpr + +extern "C" { #else #include #include #define OS_CONSTEXPR + typedef uint8_t char8_t; typedef uint16_t char16_t; typedef uint32_t char32_t; diff --git a/include/nod/Util.hpp b/include/nod/Util.hpp index 53a56c9..6825070 100644 --- a/include/nod/Util.hpp +++ b/include/nod/Util.hpp @@ -1,6 +1,7 @@ #pragma once -#if _WIN32 && UNICODE +#if _WIN32 +#include #include #include #ifndef WIN32_LEAN_AND_MEAN @@ -88,7 +89,7 @@ static inline int Stat(const char* path, Sstat* statout) { return _wstat64(wpath.get(), statout); } #else -static inline int Mkdir(const char* path, mode_t mode) { return CreateDirectoryA(path, mode); } +static inline int Mkdir(const char* path, mode_t mode) { return mkdir(path, mode); } typedef struct stat Sstat; static inline int Stat(const char* path, Sstat* statout) { return stat(path, statout); } @@ -235,14 +236,14 @@ static inline bool CheckFreeSpace(const char* path, size_t reqSz) { wchar_t* end = nullptr; DWORD ret = GetFullPathNameW(wpath.get(), 1024, buf.data(), &end); if (ret == 0 || ret > 1024) { - LogModule.report(logvisor::Error, FMT_STRING("GetFullPathNameA {}"), path); + LogModule.report(logvisor::Error, FMT_STRING("GetFullPathNameW {}"), path); return false; } if (end != nullptr) { end[0] = L'\0'; } if (!GetDiskFreeSpaceExW(buf.data(), &freeBytes, nullptr, nullptr)) { - LogModule.report(logvisor::Error, FMT_STRING("GetDiskFreeSpaceExA {}: {}"), path, GetLastError()); + LogModule.report(logvisor::Error, FMT_STRING("GetDiskFreeSpaceExW {}: {}"), path, GetLastError()); return false; } return reqSz < freeBytes.QuadPart; diff --git a/lib/DirectoryEnumerator.cpp b/lib/DirectoryEnumerator.cpp index e6f8c21..e389229 100644 --- a/lib/DirectoryEnumerator.cpp +++ b/lib/DirectoryEnumerator.cpp @@ -1,15 +1,20 @@ #include "nod/DirectoryEnumerator.hpp" #ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #include #else -#include #include +#include #endif #include #include +#ifdef __cpp_lib_ranges #include +#endif namespace nod { diff --git a/lib/OSUTF.c b/lib/OSUTF.c index 133bd7a..46ecdd3 100644 --- a/lib/OSUTF.c +++ b/lib/OSUTF.c @@ -1,6 +1,7 @@ #include "nod/OSUTF.h" #include +#include static const char16_t Sjis00[256] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, diff --git a/logvisor b/logvisor index df3c283..4f7f3f2 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit df3c283186a677d178b61240003ec4114e9a925b +Subproject commit 4f7f3f2147827715e685321874081a0a6683b0af