@@ -179,6 +179,14 @@ bool QgsMapLayer::readXML( QDomNode & layer_node )
179
179
else if ( provider == " delimitedtext" )
180
180
{
181
181
QUrl urlSource = QUrl::fromEncoded ( mDataSource .toAscii () );
182
+
183
+ if ( !mDataSource .startsWith ( " file://" ) )
184
+ {
185
+ QUrl file = QUrl::fromLocalFile ( mDataSource .left ( mDataSource .indexOf ( " ?" ) ) );
186
+ urlSource.setScheme ( " file" );
187
+ urlSource.setPath ( file.path () );
188
+ }
189
+
182
190
QUrl urlDest = QUrl::fromLocalFile ( QgsProject::instance ()->readPath ( urlSource.toLocalFile () ) );
183
191
urlDest.setQueryItems ( urlSource.queryItems () );
184
192
mDataSource = QString::fromAscii ( urlDest.toEncoded () );
@@ -309,9 +317,10 @@ bool QgsMapLayer::writeXML( QDomNode & layer_node, QDomDocument & document )
309
317
}
310
318
else if ( vlayer && vlayer->providerType () == " delimitedtext" )
311
319
{
312
- QStringList theURIParts = src.split ( " ?" );
313
- theURIParts[0 ] = QgsProject::instance ()->writePath ( theURIParts[0 ] );
314
- src = theURIParts.join ( " ?" );
320
+ QUrl urlSource = QUrl::fromEncoded ( src.toAscii () );
321
+ QUrl urlDest = QUrl::fromLocalFile ( QgsProject::instance ()->writePath ( urlSource.toLocalFile () ) );
322
+ urlDest.setQueryItems ( urlSource.queryItems () );
323
+ src = QString::fromAscii ( urlDest.toEncoded () );
315
324
}
316
325
else
317
326
{
@@ -678,8 +687,7 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
678
687
}
679
688
else if ( vlayer && vlayer->providerType () == " delimitedtext" )
680
689
{
681
- QStringList theURIParts = theURI.split ( " ?" );
682
- filename = theURIParts[0 ];
690
+ filename = QUrl::fromEncoded ( theURI.toAscii () ).toLocalFile ();
683
691
}
684
692
else
685
693
{
0 commit comments