Skip to content

Commit

Permalink
Don't append drive label if it's the same as the path
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 2, 2021
1 parent e972e78 commit a4b7873
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/browser/qgsbrowsermodel.cpp
Expand Up @@ -122,7 +122,7 @@ void QgsBrowserModel::addRootItems()
continue;

const QString driveName = QStorageInfo( path ).displayName();
const QString name = driveName.isEmpty() ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );
const QString name = driveName.isEmpty() || driveName == path ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );

QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, name, path, path, QStringLiteral( "special:Drives" ) );
item->setSortKey( QStringLiteral( " 3 %1" ).arg( path ) );
Expand Down Expand Up @@ -507,7 +507,7 @@ void QgsBrowserModel::refreshDrives()
if ( !mDriveItems.contains( path ) )
{
const QString driveName = QStorageInfo( path ).displayName();
const QString name = driveName.isEmpty() ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );
const QString name = driveName.isEmpty() || driveName == path ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );

QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, name, path, path, QStringLiteral( "special:Drives" ) );
item->setSortKey( QStringLiteral( " 3 %1" ).arg( path ) );
Expand Down

0 comments on commit a4b7873

Please sign in to comment.