diff --git a/src/util/util_env.cpp b/src/util/util_env.cpp index a759ae349..1b0901f66 100644 --- a/src/util/util_env.cpp +++ b/src/util/util_env.cpp @@ -115,9 +115,14 @@ namespace dxvk::env { bool createDirectory(const std::string& path) { #ifdef _WIN32 - WCHAR widePath[MAX_PATH]; - str::tows(path.c_str(), widePath); - return !!CreateDirectoryW(widePath, nullptr); + std::array widePath; + + size_t length = str::transcodeString( + widePath.data(), widePath.size() - 1, + path.data(), path.size()); + + widePath[length] = L'\0'; + return !!CreateDirectoryW(widePath.data(), nullptr); #else return std::filesystem::create_directories(path); #endif