Skip to content
Permalink
Browse files

layer definition: always use relative paths regardless whether or not…

… the file already exists (fixes #14340)
  • Loading branch information
jef-n committed Feb 25, 2016
1 parent f9d6905 commit 9f7c32944cf468f0da24f444c514fa90cf233841
Showing with 11 additions and 12 deletions.
  1. +0 −1 src/app/qgisapp.cpp
  2. +11 −11 src/core/qgslayerdefinition.cpp
@@ -5650,7 +5650,6 @@ void QgisApp::saveAsFile()

void QgisApp::saveAsLayerDefinition()
{

QString path = QFileDialog::getSaveFileName( this, "Save as Layer Definition File", QDir::home().path(), "*.qlr" );
QgsDebugMsg( path );
if ( path.isEmpty() )
@@ -151,22 +151,22 @@ bool QgsLayerDefinition::exportLayerDefinition( QString path, const QList<QgsLay
path = path.append( ".qlr" );

QFile file( path );
QFileInfo fileinfo( file );

QDomDocument doc( "qgis-layer-definition" );
if ( !exportLayerDefinition( doc, selectedTreeNodes, errorMessage, fileinfo.canonicalFilePath() ) )
return false;
if ( file.open( QFile::WriteOnly | QFile::Truncate ) )
{
QTextStream qlayerstream( &file );
doc.save( qlayerstream, 2 );
return true;
}
else
if ( !file.open( QFile::WriteOnly | QFile::Truncate ) )
{
errorMessage = file.errorString();
return false;
}

QFileInfo fileinfo( file );

QDomDocument doc( "qgis-layer-definition" );
if ( !exportLayerDefinition( doc, selectedTreeNodes, errorMessage, fileinfo.canonicalFilePath() ) )
return false;

QTextStream qlayerstream( &file );
doc.save( qlayerstream, 2 );
return true;
}

bool QgsLayerDefinition::exportLayerDefinition( QDomDocument doc, const QList<QgsLayerTreeNode*>& selectedTreeNodes, QString &errorMessage, const QString& relativeBasePath )

0 comments on commit 9f7c329

Please sign in to comment.
You can’t perform that action at this time.