diff --git a/src/directory.cpp b/src/directory.cpp index 4027b64..fd0f74b 100644 --- a/src/directory.cpp +++ b/src/directory.cpp @@ -10,6 +10,7 @@ #include #ifdef _WIN32 +#define UNICODE #include #else #include @@ -37,7 +38,7 @@ create_directory(std::string_view label) { } #ifdef _WIN32 - if (!CreateDirectoryW(path.c_str(), nullptr)) { + if (!CreateDirectory(path.c_str(), nullptr)) { ec = std::error_code(GetLastError(), std::system_category()); } #else @@ -52,9 +53,9 @@ create_directory(std::string_view label) { #ifdef _WIN32 HANDLE handle = - CreateFileW(path.c_str(), GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); + CreateFile(path.c_str(), GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); #else int handle = open(path.data(), O_DIRECTORY); #endif diff --git a/src/file.cpp b/src/file.cpp index 6fcf2cd..4c8ee95 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -13,6 +13,7 @@ #include #ifdef _WIN32 +#define UNICODE #include #else #include @@ -41,9 +42,9 @@ create_file(std::string_view label, std::string_view extension) { #ifdef _WIN32 HANDLE handle = - CreateFileW(path.c_str(), GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); + CreateFile(path.c_str(), GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle == INVALID_HANDLE_VALUE) { ec = std::error_code(GetLastError(), std::system_category());