Skip to content

Commit

Permalink
[FIX] Fix loading projects with . in name
Browse files Browse the repository at this point in the history
At least on Windows 2.18.qgs is a valid name for a file.
  • Loading branch information
NathanW2 committed Feb 19, 2018
1 parent 2c53630 commit 71a7de6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -5947,20 +5947,20 @@ void QgisApp::openFile( const QString &fileName )
{
// check to see if we are opening a project file
QFileInfo fi( fileName );
if ( fi.completeSuffix() == QLatin1String( "qgs" ) || fi.completeSuffix() == QLatin1String( "qgz" ) )
if ( fi.suffix() == QLatin1String( "qgs" ) || fi.suffix() == QLatin1String( "qgz" ) )
{
QgsDebugMsg( "Opening project " + fileName );
openProject( fileName );
}
else if ( fi.completeSuffix() == QLatin1String( "qlr" ) )
else if ( fi.suffix() == QLatin1String( "qlr" ) )
{
openLayerDefinition( fileName );
}
else if ( fi.completeSuffix() == QLatin1String( "qpt" ) )
else if ( fi.suffix() == QLatin1String( "qpt" ) )
{
openTemplate( fileName );
}
else if ( fi.completeSuffix() == QLatin1String( "py" ) )
else if ( fi.suffix() == QLatin1String( "py" ) )
{
runScript( fileName );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsdataitem.cpp
Expand Up @@ -798,7 +798,7 @@ QVector<QgsDataItem *> QgsDirectoryItem::createChildren()

if ( fileInfo.suffix() == QLatin1String( "qgs" ) || fileInfo.suffix() == QLatin1String( "qgz" ) )
{
QgsDataItem *item = new QgsProjectItem( this, fileInfo.baseName(), path );
QgsDataItem *item = new QgsProjectItem( this, fileInfo.completeBaseName(), path );
children.append( item );
continue;
}
Expand Down

0 comments on commit 71a7de6

Please sign in to comment.