-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Description
The new windows environment uses the *A functions instead of the *W ones:
size_t error_text_size = ::FormatMessageA(
ScopedHandle handle = ::CreateFileA(
::CreateFileA(filename.c_str(), desired_access, share_mode,
::CreateFileMappingA(handle.get(),
ScopedHandle handle = ::CreateFileA(
ScopedHandle handle = ::CreateFileA(
return GetFileAttributesA(filename.c_str()) != INVALID_FILE_ATTRIBUTES;
HANDLE dir_handle = ::FindFirstFileA(find_pattern.c_str(), &find_data);
} while (::FindNextFileA(dir_handle, &find_data));
if (!::DeleteFileA(filename.c_str())) {
if (!::CreateDirectoryA(dirname.c_str(), nullptr)) {
if (!::RemoveDirectoryA(dirname.c_str())) {
if (!::GetFileAttributesExA(filename.c_str(), GetFileExInfoStandard,
if (::MoveFileA(from.c_str(), to.c_str())) {
if (::ReplaceFileA(to.c_str(), from.c_str(), /*lpBackupFileName=*/nullptr,
ScopedHandle handle = ::CreateFileA(
if (!GetTempPathA(ARRAYSIZE(tmp_path), tmp_path)) {
I think these use what the process code page happens to be, which might not be UTF-8. I don't claim to understand Windows unicode handling, so please tell me I'm wrong, but in our previous Windows environment we used
void ToWidePath(const std::string& value, std::wstring& target) {
wchar_t buffer[MAX_PATH];
MultiByteToWideChar(CP_UTF8, 0, value.c_str(), -1, buffer, MAX_PATH);
target = buffer;
}
void ToNarrowPath(const std::wstring& value, std::string& target) {
char buffer[MAX_PATH];
WideCharToMultiByte(CP_UTF8, 0, value.c_str(), -1, buffer, MAX_PATH, NULL, NULL);
target = buffer;
}
along with the *W wide variants of Windows API functions (but #755 (comment) is a better way using std::codecvt).
I'm seeing some downstream test failures regarding file names, and I suspect this might be the cause.
elichai, sipsorcery, practicalswift, luncliff and k15tfu
Metadata
Metadata
Assignees
Labels
No labels