diff --git a/src/analysis/processing/qgsalgorithmpointstopaths.cpp b/src/analysis/processing/qgsalgorithmpointstopaths.cpp index 2b2d5e284794..3c2b91dcdac4 100644 --- a/src/analysis/processing/qgsalgorithmpointstopaths.cpp +++ b/src/analysis/processing/qgsalgorithmpointstopaths.cpp @@ -210,9 +210,10 @@ QVariantMap QgsPointsToPathsAlgorithm::processAlgorithm( const QVariantMap ¶ throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) ); const QString textDir = parameterAsString( parameters, QStringLiteral( "OUTPUT_TEXT_DIR" ), context ); - if ( ! textDir.isEmpty() && - ! QDir( textDir ).exists() ) - throw QgsProcessingException( QObject::tr( "The text output directory does not exist" ) ); + if ( !textDir.isEmpty() && !QDir().mkpath( textDir ) ) + { + throw QgsProcessingException( QObject::tr( "Failed to create the text output directory" ) ); + } QgsDistanceArea da = QgsDistanceArea(); da.setSourceCrs( source->sourceCrs(), context.transformContext() );