Skip to content

Commit b49b492

Browse files
committed
handle projects path with apostrophe (fixes #12691)
1 parent aa377a0 commit b49b492

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/app/qgisapp.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -10065,11 +10065,15 @@ void QgisApp::projectChanged( const QDomDocument &doc )
1006510065

1006610066
QString expr;
1006710067
if ( !prevProjectDir.isNull() )
10068-
expr = QString( "sys.path.remove('%1'); " ).arg( prevProjectDir );
10068+
{
10069+
QString prev = prevProjectDir;
10070+
expr = QString( "sys.path.remove('%1'); " ).arg( prev.replace( "'", "\\'" ) );
10071+
}
1006910072

1007010073
prevProjectDir = fi.canonicalPath();
1007110074

10072-
expr += QString( "sys.path.append('%1')" ).arg( prevProjectDir );
10075+
QString prev = prevProjectDir;
10076+
expr += QString( "sys.path.append('%1')" ).arg( prev.replace( "'", "\\'" ) );
1007310077

1007410078
QgsPythonRunner::run( expr );
1007510079
}

src/core/qgsfield.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Q_DECLARE_METATYPE( QgsField );
163163
*
164164
* In addition to storing a list of QgsField instances, it also:
165165
* - allows quick lookups of field names to index in the list
166-
*- keeps track of where the field definition comes from (vector data provider, joined layer or newly added from an editing operation)
166+
* - keeps track of where the field definition comes from (vector data provider, joined layer or newly added from an editing operation)
167167
* \note QgsFields objects are implicitly shared.
168168
*/
169169
class CORE_EXPORT QgsFields

0 commit comments

Comments
 (0)