mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1665 Add runOctaveScript command to command file interface
This commit is contained in:
57
ApplicationCode/CommandFileInterface/RicfRunOctaveScript.cpp
Normal file
57
ApplicationCode/CommandFileInterface/RicfRunOctaveScript.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "RicfRunOctaveScript.h"
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicfRunOctaveScript.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfRunOctaveScript, "runOctaveScript");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfRunOctaveScript::RicfRunOctaveScript()
|
||||
{
|
||||
RICF_InitField(&m_path, "path", QString(), "Path", "", "", "");
|
||||
RICF_InitField(&m_caseIds, "cases", std::vector<int>(), "Case IDs", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfRunOctaveScript::execute()
|
||||
{
|
||||
QString octavePath = RiaApplication::instance()->octavePath();
|
||||
QFileInfo scriptFileInfo(m_path());
|
||||
QStringList processArguments;
|
||||
|
||||
processArguments << "--path" << scriptFileInfo.absolutePath();
|
||||
processArguments << scriptFileInfo.absoluteFilePath();
|
||||
|
||||
if (m_caseIds().empty())
|
||||
{
|
||||
RiaApplication::instance()->launchProcess(octavePath, processArguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaApplication::instance()->launchProcessForMultipleCases(octavePath, processArguments, m_caseIds());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user