diff --git a/app/main.cpp b/app/main.cpp index 896be263..2a376861 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -301,6 +301,11 @@ int main(int argc, char *argv[]) Path::initialize(false); } + // Override the default QML cache directory with the one we chose + if (qEnvironmentVariableIsEmpty("QML_DISK_CACHE_PATH")) { + qputenv("QML_DISK_CACHE_PATH", Path::getQmlCacheDir().toUtf8()); + } + #ifdef USE_CUSTOM_LOGGER #ifdef LOG_TO_FILE QDir tempDir(Path::getLogDir()); diff --git a/app/path.cpp b/app/path.cpp index ea48ea16..4bd7c18a 100644 --- a/app/path.cpp +++ b/app/path.cpp @@ -9,6 +9,7 @@ QString Path::s_CacheDir; QString Path::s_LogDir; QString Path::s_BoxArtCacheDir; +QString Path::s_QmlCacheDir; QString Path::getLogDir() { @@ -22,6 +23,12 @@ QString Path::getBoxArtCacheDir() return s_BoxArtCacheDir; } +QString Path::getQmlCacheDir() +{ + Q_ASSERT(!s_QmlCacheDir.isEmpty()); + return s_QmlCacheDir; +} + QByteArray Path::readDataFile(QString fileName) { QFile dataFile(getDataFilePath(fileName)); @@ -97,6 +104,7 @@ void Path::initialize(bool portable) if (portable) { s_LogDir = QDir::currentPath(); s_BoxArtCacheDir = QDir::currentPath() + "/boxart"; + s_QmlCacheDir = QDir::currentPath() + "/qmlcache"; // In order for the If-Modified-Since logic to work in MappingFetcher, // the cache directory must be different than the current directory. @@ -112,5 +120,6 @@ void Path::initialize(bool portable) #endif s_CacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); s_BoxArtCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/boxart"; + s_QmlCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/qmlcache"; } } diff --git a/app/path.h b/app/path.h index 430c40a9..fcb5a20a 100644 --- a/app/path.h +++ b/app/path.h @@ -7,8 +7,8 @@ class Path { public: static QString getLogDir(); - static QString getBoxArtCacheDir(); + static QString getQmlCacheDir(); static QByteArray readDataFile(QString fileName); static void writeCacheFile(QString fileName, QByteArray data); @@ -24,4 +24,5 @@ private: static QString s_CacheDir; static QString s_LogDir; static QString s_BoxArtCacheDir; + static QString s_QmlCacheDir; }; diff --git a/scripts/build-arch.bat b/scripts/build-arch.bat index 2429fc21..66912d0d 100644 --- a/scripts/build-arch.bat +++ b/scripts/build-arch.bat @@ -185,14 +185,6 @@ rmdir /s /q %DEPLOY_FOLDER%\QtQuick\Controls\Fusion rmdir /s /q %DEPLOY_FOLDER%\QtQuick\Controls\Imagine rmdir /s /q %DEPLOY_FOLDER%\QtQuick\Controls\Universal -echo Generating QML cache -forfiles /p %DEPLOY_FOLDER% /m *.qml /s /c "cmd /c qmlcachegen.exe @path" -if !ERRORLEVEL! NEQ 0 goto Error - -echo Deleting original QML files -forfiles /p %DEPLOY_FOLDER% /m *.qml /s /c "cmd /c del @path" -if !ERRORLEVEL! NEQ 0 goto Error - if "%SIGN%"=="1" ( echo Signing deployed binaries set FILES_TO_SIGN=%BUILD_FOLDER%\app\%BUILD_CONFIG%\Moonlight.exe