Skip to content

Commit e5dbd18

Browse files
committed
grass: fix relative path support for working database and vector layers (fixes #12725)
1 parent eb716fc commit e5dbd18

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/core/qgsproject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ QString QgsProject::writePath( QString src, QString relativeBasePath ) const
14791479

14801480
QFileInfo srcFileInfo( src );
14811481
QFileInfo projFileInfo( fileName() );
1482-
QString srcPath = srcFileInfo.canonicalFilePath();
1482+
QString srcPath = srcFileInfo.exists() ? srcFileInfo.canonicalFilePath() : src;
14831483
QString projPath = projFileInfo.canonicalFilePath();
14841484

14851485
if ( !relativeBasePath.isNull() )

src/plugins/grass/qgsgrassplugin.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ void QgsGrassPlugin::saveMapset()
303303

304304
// Save working mapset in project file
305305
QgsProject::instance()->writeEntry( "GRASS", "/WorkingGisdbase",
306-
QgsGrass::getDefaultGisdbase() );
306+
QgsProject::instance()->writePath( QgsGrass::getDefaultGisdbase() ) );
307307

308308
QgsProject::instance()->writeEntry( "GRASS", "/WorkingLocation",
309309
QgsGrass::getDefaultLocation() );
@@ -796,8 +796,10 @@ void QgsGrassPlugin::projectRead()
796796
QgsDebugMsg( "entered." );
797797

798798
bool ok;
799-
QString gisdbase = QgsProject::instance()->readEntry(
800-
"GRASS", "/WorkingGisdbase", "", &ok ).trimmed();
799+
QString gisdbase = QgsProject::instance()->readPath(
800+
QgsProject::instance()->readEntry(
801+
"GRASS", "/WorkingGisdbase", "", &ok ).trimmed()
802+
);
801803
QString location = QgsProject::instance()->readEntry(
802804
"GRASS", "/WorkingLocation", "", &ok ).trimmed();
803805
QString mapset = QgsProject::instance()->readEntry(

0 commit comments

Comments
 (0)