Skip to content

Commit

Permalink
Stored paths must NEVER be windows style paths
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 10, 2021
1 parent b03508f commit d13689d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/app/qgshandlebadlayers.cpp
Expand Up @@ -408,7 +408,6 @@ void QgsHandleBadLayers::apply()
const QString basepath = dataInfo.absoluteDir().path();
const QString longName = dataInfo.fileName();
const QString provider = mLayerList->item( i, 0 )->data( static_cast< int >( CustomRoles::Provider ) ).toString();
const QString fileType = mLayerList->item( i, 2 )->text();

QVariantMap providerMap = QgsProviderRegistry::instance()->decodeUri( provider, dataInfo.absoluteFilePath() );
if ( providerMap.contains( QStringLiteral( "path" ) ) )
Expand All @@ -421,7 +420,7 @@ void QgsHandleBadLayers::apply()
const QVariant dataSourceIsChanged = mLayerList->item( i, 0 )->data( static_cast< int >( CustomRoles::DataSourceIsChanged ) );
if ( !( dataSourceIsChanged.isValid() && dataSourceIsChanged.toBool() ) )
{
datasource = QDir::toNativeSeparators( checkBasepath( layerId, basepath, fileName ).replace( fileName, longName ) );
datasource = checkBasepath( layerId, basepath, fileName ).replace( fileName, longName );
}

bool dataSourceChanged { false };
Expand Down Expand Up @@ -588,7 +587,7 @@ void QgsHandleBadLayers::autoFind()
continue;
}

datasource = QDir::toNativeSeparators( checkBasepath( layerId, basepath, fileName ) );
datasource = checkBasepath( layerId, basepath, fileName );

bool dataSourceChanged { false };

Expand Down Expand Up @@ -622,7 +621,6 @@ void QgsHandleBadLayers::autoFind()
datasource = tdatasource;
}

datasource = QDir::toNativeSeparators( datasource );
if ( QgsProject::instance()->mapLayer( layerId ) && !( datasource.isEmpty() ) )
{
QgsDataProvider::ProviderOptions options;
Expand Down

0 comments on commit d13689d

Please sign in to comment.