Skip to content
Permalink
Browse files

Stored paths must NEVER be windows style paths

  • Loading branch information
nyalldawson committed Mar 10, 2021
1 parent b03508f commit d13689d533e4c43c4a3c7c84ca3a110ff3f15028
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/app/qgshandlebadlayers.cpp
@@ -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" ) ) )
@@ -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 };
@@ -588,7 +587,7 @@ void QgsHandleBadLayers::autoFind()
continue;
}

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

bool dataSourceChanged { false };

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

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

0 comments on commit d13689d

Please sign in to comment.