Skip to content

Commit cadc793

Browse files
committed
Fix compilation with MinGW on Windows
1 parent 2e95b45 commit cadc793

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

build/cmake/SetupBuildEnvironment.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ elseif(CC_IS_MINGW)
5353
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware")
5454
endif (NOT BUILD_64)
5555

56+
add_definitions(-D_UNICODE)
57+
add_definitions(-DUNICODE)
58+
5659
elseif(CC_IS_CLANG)
5760
message(STATUS "Using Compiler CLANG ${CMAKE_CXX_COMPILER_VERSION}")
5861

src/libmscore/scorefile.cpp

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

0 commit comments

Comments
 (0)