mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-31 10:28:12 -04:00
Add Unicode support for database filenames on Windows (#8782)
Fixes #8751
This commit is contained in:
parent
3cbe4df8c7
commit
afc7dcd83c
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user