Skip to content

Commit

Permalink
Properly deal with empty cache/directory in WFS provider, server and …
Browse files Browse the repository at this point in the history
…globe plugin

Fixes #15111
  • Loading branch information
rouault committed Oct 6, 2016
1 parent eba8c5d commit 763d97f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/plugins/globe/globe_plugin.cpp
Expand Up @@ -342,7 +342,9 @@ void GlobePlugin::run()
}
else
{
QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
QString cacheDirectory = settings.value( "cache/directory" ).toString();
if ( cacheDirectory.isEmpty() )
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
osgEarth::Drivers::FileSystemCacheOptions cacheOptions;
cacheOptions.rootPath() = cacheDirectory.toStdString();

Expand Down
4 changes: 3 additions & 1 deletion src/providers/wfs/qgswfsutils.cpp
Expand Up @@ -37,7 +37,9 @@ int QgsWFSUtils::gmCounter = 0;
QString QgsWFSUtils::getBaseCacheDirectory( bool createIfNotExisting )
{
QSettings settings;
QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
QString cacheDirectory = settings.value( "cache/directory" ).toString();
if ( cacheDirectory.isEmpty() )
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
if ( createIfNotExisting )
{
QMutexLocker locker( &gmMutex );
Expand Down
4 changes: 3 additions & 1 deletion src/server/qgsserver.cpp
Expand Up @@ -115,7 +115,9 @@ void QgsServer::setupNetworkAccessManager()
QSettings settings;
QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance();
QNetworkDiskCache *cache = new QNetworkDiskCache( nullptr );
QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
QString cacheDirectory = settings.value( "cache/directory" ).toString();
if ( cacheDirectory.isEmpty() )
cacheDirectory = QgsApplication::qgisSettingsDirPath() + "cache";
qint64 cacheSize = settings.value( "cache/size", 50 * 1024 * 1024 ).toULongLong();
QgsMessageLog::logMessage( QString( "setCacheDirectory: %1" ).arg( cacheDirectory ), "Server", QgsMessageLog::INFO );
QgsMessageLog::logMessage( QString( "setMaximumCacheSize: %1" ).arg( cacheSize ), "Server", QgsMessageLog::INFO );
Expand Down

0 comments on commit 763d97f

Please sign in to comment.