mirror of https://github.com/mgba-emu/mgba.git
Qt: Handle relative DATADIR
This commit is contained in:
parent
96fe40efc1
commit
770b121b10
|
@ -272,7 +272,11 @@ if(BUILD_GL OR BUILD_GLES2 OR BUILD_EPOXY)
|
||||||
endif()
|
endif()
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
|
install(FILES ${CMAKE_SOURCE_DIR}/res/nointro.dat DESTINATION ${DATADIR} COMPONENT ${BINARY_NAME}-qt)
|
||||||
if(NOT WIN32 AND NOT APPLE)
|
if(NOT WIN32 AND NOT APPLE)
|
||||||
|
if(DATADIR MATCHES "^\\.[.\\]")
|
||||||
|
list(APPEND QT_DEFINES DATADIR="${DATADIR}")
|
||||||
|
else()
|
||||||
list(APPEND QT_DEFINES DATADIR="${CMAKE_INSTALL_PREFIX}/${DATADIR}")
|
list(APPEND QT_DEFINES DATADIR="${CMAKE_INSTALL_PREFIX}/${DATADIR}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5LinguistTools)
|
find_package(Qt5LinguistTools)
|
||||||
|
|
|
@ -207,6 +207,9 @@ QString GBAApp::getOpenDirectoryName(QWidget* owner, const QString& title, const
|
||||||
QString GBAApp::dataDir() {
|
QString GBAApp::dataDir() {
|
||||||
#ifdef DATADIR
|
#ifdef DATADIR
|
||||||
QString path = QString::fromUtf8(DATADIR);
|
QString path = QString::fromUtf8(DATADIR);
|
||||||
|
if (path.startsWith("./") || path.startsWith("../")) {
|
||||||
|
path = QCoreApplication::applicationDirPath() + "/" + path;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
QString path = QCoreApplication::applicationDirPath();
|
QString path = QCoreApplication::applicationDirPath();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
|
Loading…
Reference in New Issue