Allow moc to handle Unicode output filenames on Windows with MSVC

The C standard library functions cannot handle UTF-8 filenames. Instead,
we need to use the wide-character versions which accept UTF-16 input.

Task-number: QTBUG-65492
Change-Id: If4b3b4eeeec4f3bbb428b8f6b0311a65d01463b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Jake Petroules 2017-12-27 12:42:26 -08:00
parent 6f7b64e2a9
commit 44da5b8635
1 changed files with 2 additions and 2 deletions

View File

@ -486,8 +486,8 @@ int runMoc(int argc, char **argv)
// 3. and output meta object code
if (output.size()) { // output file specified
#if defined(_MSC_VER) && _MSC_VER >= 1400
if (fopen_s(&out, QFile::encodeName(output).constData(), "w"))
#if defined(_MSC_VER)
if (_wfopen_s(&out, reinterpret_cast<const wchar_t *>(output.utf16()), L"w") != 0)
#else
out = fopen(QFile::encodeName(output).constData(), "w"); // create output file
if (!out)