Skip to content

Commit

Permalink
temp path for processing output configurable
Browse files Browse the repository at this point in the history
(cherry picked from commit 8274566)
  • Loading branch information
signedav authored and nirvn committed Nov 29, 2019
1 parent 0059f9f commit 20e5e32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion python/plugins/processing/core/ProcessingConfig.py
Expand Up @@ -28,7 +28,8 @@
QgsApplication,
QgsSettings,
QgsVectorFileWriter,
QgsRasterFileWriter)
QgsRasterFileWriter,
QgsProcessingUtils)
from processing.tools.system import defaultOutputFolder
import processing.tools.dataobjects
from multiprocessing import cpu_count
Expand Down Expand Up @@ -60,6 +61,7 @@ class ProcessingConfig:
MAX_THREADS = 'MAX_THREADS'
DEFAULT_OUTPUT_RASTER_LAYER_EXT = 'DefaultOutputRasterLayerExt'
DEFAULT_OUTPUT_VECTOR_LAYER_EXT = 'DefaultOutputVectorLayerExt'
TEMP_PATH = 'TEMP_PATH'

settings = {}
settingIcons = {}
Expand Down Expand Up @@ -165,6 +167,12 @@ def initialize():
valuetype=Setting.SELECTION,
options=extensions))

ProcessingConfig.addSetting(Setting(
ProcessingConfig.tr('General'),
ProcessingConfig.TEMP_PATH,
ProcessingConfig.tr('Temporary output folder path'), QgsProcessingUtils.tempFolder(),
valuetype=Setting.FOLDER))

@staticmethod
def setGroupIcon(group, icon):
ProcessingConfig.settingIcons[group] = icon
Expand Down
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingutils.cpp
Expand Up @@ -691,7 +691,7 @@ QString QgsProcessingUtils::tempFolder()
if ( sFolder.isEmpty() )
{
QString subPath = QUuid::createUuid().toString().remove( '-' ).remove( '{' ).remove( '}' );
sFolder = QDir::tempPath() + QStringLiteral( "/processing_" ) + subPath;
sFolder = QgsSettings().value( QStringLiteral( "Processing/Configuration/TEMP_PATH" ), QDir::tempPath() ).toString() + QStringLiteral( "/processing_" ) + subPath;
if ( !QDir( sFolder ).exists() )
QDir().mkpath( sFolder );
}
Expand Down

0 comments on commit 20e5e32

Please sign in to comment.