~agateau/unity-2d/fix-stuck-launcher-after-spread

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#define INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
#define UNITY_2D_DIR "${UNITY_2D_DIR}"
#define UNITY_DIR "${UNITY_DIR}"

#include <QCoreApplication>

inline bool isRunningInstalled() {
    static bool cachedResult = QCoreApplication::applicationDirPath() == INSTALL_PREFIX "/bin";
    return cachedResult;
}

inline QString unity2dDirectory() {
    if (isRunningInstalled()) {
        return QString(INSTALL_PREFIX "/" UNITY_2D_DIR);
    } else {
        return QString(QCoreApplication::applicationDirPath()+"/../../");
    }
}

inline QString unity2dImportPath() {
    if (isRunningInstalled()) {
        return QString(INSTALL_PREFIX "/lib/qt4/imports");
    } else {
        return QString(QCoreApplication::applicationDirPath()+"/../");
    }
}