Skip to content
Snippets Groups Projects
Commit 7b49233e authored by Elliot Oram's avatar Elliot Oram
Browse files

Option of using curent working dir if default save not provided

Refs #16248
parent fc8eebb5
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,10 @@ class Quest(PythonAlgorithm):
saveOp = self.getProperty('Save').value
workdir = config['defaultsave.directory']
if not os.path.isdir(workdir):
workdir = os.getcwd()
logger.information('Default Save directory is not set. Defaulting to current working Directory: ' + workdir)
if inType == 'File':
spath = os.path.join(workdir, sname+'.nxs') # path name for sample nxs file
LoadNexusProcessed(Filename=spath, OutputWorkspace=sname)
......
......@@ -83,6 +83,23 @@ bool Stretch::validate() {
void Stretch::run() {
using namespace Mantid::API;
auto saveDirectory = Mantid::Kernel::ConfigService::Instance().getString(
"defaultsave.directory");
if (saveDirectory.compare("") == 0) {
const char *textMessage =
"BayesStretch requires a default save directory and "
"one is not currently set."
" If run, the algorithm will default to saving files "
"to the current working directory."
" Would you still like to run the algorithm?";
int result = QMessageBox::question(NULL, tr("Save Directory"),
tr(textMessage), QMessageBox::Yes,
QMessageBox::No, QMessageBox::NoButton);
if (result == QMessageBox::No) {
return;
}
}
QString save("False");
QString elasticPeak("False");
......
......@@ -506,7 +506,10 @@ def QuestRun(samWS,resWS,nbs,erange,nbins,Fit,Loop,Plot,Save):
fitOp = [o_el, o_bgd, o_w1, o_res]
workdir = getDefaultWorkingDirectory()
workdir = config['defaultsave.directory']
if not os.path.isdir(workdir):
workdir = os.getcwd()
logger.information('Default Save directory is not set. Defaulting to current working Directory: ' + workdir)
array_len = 4096 # length of array in Fortran
CheckXrange(erange,'Energy')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment