Skip to content
Permalink
Browse files

[Geometry checker] Imporove logic for picking the output directory

  • Loading branch information
manisandro committed Jun 28, 2017
1 parent 018467f commit b80fa36450bd72b9bba77afa0193474c87586adb
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp
@@ -216,21 +216,21 @@ void QgsGeometryCheckerSetupTab::selectOutputDirectory()
}
}
QString initialdir = ui.lineEditOutputDirectory->text();
if ( !QDir( initialdir ).exists() )
if ( initialdir.isEmpty() || !QDir( initialdir ).exists() )
{
QList<QgsVectorLayer *> layers = getSelectedLayers();
if ( !layers.isEmpty() )
for ( const QgsVectorLayer *layer : getSelectedLayers() )
{
QDir dir = QFileInfo( layers.front()->dataProvider()->dataSourceUri() ).dir();
QDir dir = QFileInfo( layer->dataProvider()->dataSourceUri() ).dir();
if ( dir.exists() )
{
initialdir = dir.absoluteFilePath( tr( "geometry_checker_result" ) );
initialdir = dir.absolutePath();
break;
}
}
else
{
initialdir = QDir::home().absoluteFilePath( tr( "geometry_checker_result" ) );
}
}
if ( initialdir.isEmpty() || !QDir( initialdir ).exists() )
{
initialdir = QDir::homePath();
}
QString dir = QFileDialog::getExistingDirectory( this, tr( "Select Output Directory" ), initialdir );
if ( !dir.isEmpty() )
@@ -252,7 +252,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
{
if ( layer->dataProvider()->dataSourceUri().startsWith( ui.lineEditOutputDirectory->text() ) )
{
QMessageBox::critical( this, tr( "Invalid Output Layer" ), tr( "The chosen output directory contains one or more input layers." ) );
QMessageBox::critical( this, tr( "Invalid Output Directory" ), tr( "The chosen output directory contains one or more input layers." ) );
return;
}
}

0 comments on commit b80fa36

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