Skip to content

Commit bbdd46b

Browse files
shoogleJojo-Schmitz
authored andcommitted
Switch MinGW build to use UNICODE too
Partial backport of musescore#7744
1 parent 09b8617 commit bbdd46b

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ else (APPLE)
312312
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /W4 /Zi /O2 /Ob1 /DNDEBUG")
313313
set(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE:NO")
314314
else (MSVC)
315-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
315+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -D_UNICODE -DUNICODE")
316316
if (MINGW)
317317
# -mno-ms-bitfields see #22048
318318
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields")

libmscore/scorefile.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,7 @@ bool MasterScore::saveFile(bool generateBackup)
447447
dir.mkdir(backupSubdirString);
448448
#ifdef Q_OS_WIN
449449
const QString backupDirNativePath = QDir::toNativeSeparators(backupDirString);
450-
#if (defined (_MSCVER) || defined (_MSC_VER))
451-
#if (defined (UNICODE))
452-
SetFileAttributes((LPCTSTR)backupDirNativePath.unicode(), FILE_ATTRIBUTE_HIDDEN);
453-
#else
454-
// Use byte-based Windows function
455-
SetFileAttributes((LPCTSTR)backupDirNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN);
456-
#endif
457-
#else
458-
SetFileAttributes((LPCTSTR)backupDirNativePath.toLocal8Bit(), FILE_ATTRIBUTE_HIDDEN);
459-
#endif
450+
SetFileAttributesW(reinterpret_cast<LPCWSTR>(backupDirNativePath.utf16()), FILE_ATTRIBUTE_HIDDEN);
460451
#endif
461452
}
462453
const QString backupName = QString(".") + info.fileName() + QString(",");

0 commit comments

Comments
 (0)