mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-09 23:12:23 -04:00
Add Unicode support for database filenames on Windows (#8782)
Fixes #8751
This commit is contained in:
parent
9ba88e2f13
commit
d5adf7592c
1 changed files with 4 additions and 3 deletions
|
@ -120,11 +120,12 @@ int main(int argc, char** argv)
|
||||||
// Get correct case for Windows filenames (fixes #7139)
|
// Get correct case for Windows filenames (fixes #7139)
|
||||||
for (const auto& file : parser.positionalArguments()) {
|
for (const auto& file : parser.positionalArguments()) {
|
||||||
const auto fileInfo = QFileInfo(file);
|
const auto fileInfo = QFileInfo(file);
|
||||||
WIN32_FIND_DATA findFileData;
|
WIN32_FIND_DATAW findFileData;
|
||||||
HANDLE hFind;
|
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) {
|
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);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue