#4284 runOctaveScript : If no case id is specified, run script on all cases

This commit is contained in:
Magne Sjaastad 2019-04-05 09:34:02 +02:00
parent 93d960d211
commit f99a332277

View File

@ -23,6 +23,8 @@
#include "RiaLogging.h"
#include "RimCalcScript.h"
#include "RimEclipseCase.h"
#include "RimProject.h"
#include <QFileInfo>
@ -46,14 +48,28 @@ void RicfRunOctaveScript::execute()
QStringList processArguments = RimCalcScript::createCommandLineArguments(m_path());
std::vector<int> caseIds = m_caseIds();
if (caseIds.empty())
{
RimProject* project = RiaApplication::instance()->project();
if (project)
{
auto eclipeCases = project->eclipseCases();
for (auto c : eclipeCases)
{
caseIds.push_back(c->caseId());
}
}
}
bool ok;
if (m_caseIds().empty())
if (caseIds.empty())
{
ok = RiaApplication::instance()->launchProcess(octavePath, processArguments);
}
else
{
ok = RiaApplication::instance()->launchProcessForMultipleCases(octavePath, processArguments, m_caseIds());
ok = RiaApplication::instance()->launchProcessForMultipleCases(octavePath, processArguments, caseIds);
}
if (!ok)
{