mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 05:53:25 -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 "";
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user