Skip to content

Commit c61099c

Browse files
author
g_j_m
committedSep 26, 2006
fix for ticket #309 (incorrect error message when loading a vector
file from the command line, and a loitoring hourglass). git-svn-id: http://svn.osgeo.org/qgis/trunk@5874 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent db84520 commit c61099c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed
 

‎src/gui/qgisapp.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,20 +2919,21 @@ bool QgisApp::openLayer(const QString & fileName)
29192919
{
29202920
QFileInfo fileInfo(fileName);
29212921
// try to load it as raster
2922-
bool ok = addRasterLayer(fileInfo, false);
2922+
bool ok = false;
2923+
CPLPushErrorHandler(CPLQuietErrorHandler);
2924+
if (QgsRasterLayer::isValidRasterFileName(fileName))
2925+
ok = addRasterLayer(fileInfo, false);
2926+
else // nope - try to load it as a shape/ogr
2927+
ok = addLayer(fileInfo);
2928+
CPLPopErrorHandler();
2929+
29232930
if (!ok)
29242931
{
2925-
// nope - try to load it as a shape/ogr
2926-
ok = addLayer(fileInfo);
29272932
// we have no idea what this file is...
2928-
if (!ok)
2929-
{
2930-
std::cout << "Unable to load " << fileName.toLocal8Bit().data() << std::endl;
2931-
}
2933+
std::cout << "Unable to load " << fileName.toLocal8Bit().data() << std::endl;
29322934
}
2933-
#ifdef WIN32
2934-
return true;
2935-
#endif
2935+
2936+
return ok;
29362937
}
29372938

29382939

@@ -4976,6 +4977,7 @@ bool QgisApp::addRasterLayer(QFileInfo const & rasterFile, bool guiWarning)
49764977
+ tr(" is not a valid or recognized raster data source"));
49774978
QMessageBox::critical(this, tr("Invalid Data Source"), msg);
49784979
}
4980+
delete layer;
49794981
return false;
49804982
}
49814983
else

0 commit comments

Comments
 (0)
Please sign in to comment.