Skip to content

Commit

Permalink
Add Unicode support for database filenames on Windows (#8782)
Browse files Browse the repository at this point in the history
Fixes #8751
  • Loading branch information
jNullj authored and droidmonkey committed Feb 18, 2023
1 parent 9ba88e2 commit d5adf75
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ int main(int argc, char** argv)
// Get correct case for Windows filenames (fixes #7139)
for (const auto& file : parser.positionalArguments()) {
const auto fileInfo = QFileInfo(file);
WIN32_FIND_DATA findFileData;
WIN32_FIND_DATAW findFileData;
HANDLE hFind;
hFind = FindFirstFile(fileInfo.absoluteFilePath().toUtf8(), &findFileData);
const wchar_t* absolutePathWchar = reinterpret_cast<const wchar_t*>(fileInfo.absoluteFilePath().utf16());
hFind = FindFirstFileW(absolutePathWchar, &findFileData);
if (hFind != INVALID_HANDLE_VALUE) {
fileNames << QString("%1/%2").arg(fileInfo.absolutePath(), QString::fromUtf8(findFileData.cFileName));
fileNames << QString("%1/%2").arg(fileInfo.absolutePath(), QString::fromWCharArray(findFileData.cFileName));
FindClose(hFind);
}
}
Expand Down

0 comments on commit d5adf75

Please sign in to comment.