Skip to content

Commit 89ddd03

Browse files
committed
Set gdal PAM env dir on application init
1 parent 7196dfc commit 89ddd03

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/core/qgsapplication.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ void QgsApplication::init( QString customConfigPath )
116116
}
117117

118118
mDefaultSvgPaths << qgisSettingsDirPath() + QString( "svg/" );
119+
120+
// set a working directory up for gdal to write .aux.xml files into
121+
// for cases where the raster dir is read only to the user
122+
// if the env var is already set it will be used preferentially
123+
QString myPamPath = qgisSettingsDirPath() + QString( "gdal_pam/" );
124+
QDir myDir( myPamPath );
125+
if ( !myDir.exists() )
126+
{
127+
myDir.mkpath( myPamPath ); //fail silently
128+
}
129+
int myChangeFlag = 0; //whether we want to force the env var to change
130+
setenv( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8(), myChangeFlag );
119131
}
120132

121133
QgsApplication::~QgsApplication()

0 commit comments

Comments
 (0)