Skip to content

Commit b58bcb6

Browse files
m-kuhnnyalldawson
authored andcommittedJun 5, 2019
Use system cache location instead of profile folder for network cache
Profile folders are often on network drives and shared among machines whereas the cache should be local (as fast as possible) and is disposable.
1 parent 51045a3 commit b58bcb6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/core/qgsnetworkaccessmanager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <QNetworkReply>
3535
#include <QThreadStorage>
3636
#include <QAuthenticator>
37+
#include <QStandardPaths>
3738

3839
#ifndef QT_NO_SSL
3940
#include <QSslConfiguration>
@@ -390,8 +391,8 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache( Qt::ConnectionType conn
390391

391392
QString cacheDirectory = settings.value( QStringLiteral( "cache/directory" ) ).toString();
392393
if ( cacheDirectory.isEmpty() )
393-
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
394-
qint64 cacheSize = settings.value( QStringLiteral( "cache/size" ), 50 * 1024 * 1024 ).toULongLong();
394+
cacheDirectory = QStandardPaths::writableLocation( QStandardPaths::CacheLocation );
395+
qint64 cacheSize = settings.value( QStringLiteral( "cache/size" ), 50 * 1024 * 1024 ).toLongLong();
395396
newcache->setCacheDirectory( cacheDirectory );
396397
newcache->setMaximumCacheSize( cacheSize );
397398
QgsDebugMsgLevel( QStringLiteral( "cacheDirectory: %1" ).arg( newcache->cacheDirectory() ), 4 );

0 commit comments

Comments
 (0)
Please sign in to comment.