mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-20 21:43:20 -06:00
Add bash/csh for external scripts on linux.
This commit is contained in:
parent
9c74e58510
commit
304ba4dedc
@ -164,14 +164,24 @@ bool RimProcess::execute()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimProcess::needsCommandInterpreter() const
|
||||
QString RimProcess::optionalCommandInterpreter() const
|
||||
{
|
||||
#ifdef WIN32
|
||||
if ( m_command.value().isNull() ) return false;
|
||||
return m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) ||
|
||||
m_command.value().endsWith( ".bat", Qt::CaseInsensitive );
|
||||
#endif
|
||||
return false;
|
||||
if ( m_command.value().isNull() ) return "";
|
||||
|
||||
if ( m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) ||
|
||||
m_command.value().endsWith( ".bat", Qt::CaseInsensitive ) )
|
||||
{
|
||||
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;
|
||||
|
||||
if ( needsCommandInterpreter() )
|
||||
{
|
||||
cmdline += "cmd.exe /c ";
|
||||
}
|
||||
cmdline += optionalCommandInterpreter();
|
||||
|
||||
cmdline += handleSpaces( m_command );
|
||||
|
||||
|
@ -51,7 +51,7 @@ protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
bool needsCommandInterpreter() const;
|
||||
QString optionalCommandInterpreter() const;
|
||||
QString handleSpaces( QString argument ) const;
|
||||
|
||||
caf::PdmField<QString> m_command;
|
||||
|
Loading…
Reference in New Issue
Block a user