mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
Add bash/csh for external scripts on linux.
This commit is contained in:
1 parent
9c74e58510
commit
304ba4dedc
2 files changed
+19
-12
No files matched your search
@@ -164,14 +164,24 @@ bool RimProcess::execute()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimProcess::needsCommandInterpreter() const
|
QString RimProcess::optionalCommandInterpreter() const
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
if ( m_command.value().isNull() ) return "";
|
||||||
if ( m_command.value().isNull() ) return false;
|
|
||||||
return m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) ||
|
if ( m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) ||
|
||||||
m_command.value().endsWith( ".bat", Qt::CaseInsensitive );
|
m_command.value().endsWith( ".bat", Qt::CaseInsensitive ) )
|
||||||
#endif
|
{
|
||||||
return false;
|
return "cmd.exe /c ";
|
||||||
|
}
|
||||||
|
if ( m_command.value().endsWith( ".sh", Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
return "bash ";
|
||||||
|
}
|
||||||
|
if ( m_command.value().endsWith( ".csh", Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
return "csh ";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -181,10 +191,7 @@ QString RimProcess::commandLine() const
|
|||||||
{
|
{
|
||||||
QString cmdline;
|
QString cmdline;
|
||||||
|
|
||||||
if ( needsCommandInterpreter() )
|
cmdline += optionalCommandInterpreter();
|
||||||
{
|
|
||||||
cmdline += "cmd.exe /c ";
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdline += handleSpaces( m_command );
|
cmdline += handleSpaces( m_command );
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ protected:
|
|||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool needsCommandInterpreter() const;
|
QString optionalCommandInterpreter() const;
|
||||||
QString handleSpaces( QString argument ) const;
|
QString handleSpaces( QString argument ) const;
|
||||||
|
|
||||||
caf::PdmField<QString> m_command;
|
caf::PdmField<QString> m_command;
|
||||||
|
|||||||
Reference in new issue
Block a user