Skip to content
Permalink
Browse files

move creation of gdal_pam to createDB (fixes #8613)

  • Loading branch information
jef-n committed Sep 16, 2013
1 parent 30a271c commit 4e2d1482361ca2441c76667e89cb2393563687f5
Showing with 20 additions and 20 deletions.
  1. +20 −20 src/core/qgsapplication.cpp
@@ -178,25 +178,6 @@ void QgsApplication::init( QString customConfigPath )
}
ABISYM( mSystemEnvVars ) = systemEnvVarMap;

// set a working directory up for gdal to write .aux.xml files into
// for cases where the raster dir is read only to the user
// if the env var is already set it will be used preferentially
QString myPamPath = qgisSettingsDirPath() + QString( "gdal_pam/" );
QDir myDir( myPamPath );
if ( !myDir.exists() )
{
myDir.mkpath( myPamPath ); //fail silently
}


#if defined(Q_WS_WIN32) || defined(WIN32)
CPLSetConfigOption( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
#else
//under other OS's we use an environment var so the user can
//override the path if he likes
int myChangeFlag = 0; //whether we want to force the env var to change
setenv( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8(), myChangeFlag );
#endif
}

QgsApplication::~QgsApplication()
@@ -900,8 +881,27 @@ void QgsApplication::applyGdalSkippedDrivers()
GDALAllRegister(); //to update driver list and skip missing ones
}

bool QgsApplication::createDB( QString* errorMessage )
bool QgsApplication::createDB( QString *errorMessage )
{
// set a working directory up for gdal to write .aux.xml files into
// for cases where the raster dir is read only to the user
// if the env var is already set it will be used preferentially
QString myPamPath = qgisSettingsDirPath() + QString( "gdal_pam/" );
QDir myDir( myPamPath );
if ( !myDir.exists() )
{
myDir.mkpath( myPamPath ); //fail silently
}

#if defined(Q_WS_WIN32) || defined(WIN32)
CPLSetConfigOption( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
#else
//under other OS's we use an environment var so the user can
//override the path if he likes
int myChangeFlag = 0; //whether we want to force the env var to change
setenv( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8(), myChangeFlag );
#endif

// Check qgis.db and make private copy if necessary
QFile qgisPrivateDbFile( QgsApplication::qgisUserDbFilePath() );

0 comments on commit 4e2d148

Please sign in to comment.