Skip to content

Commit

Permalink
- Added support to OMShell to function without OPENMODELICAHOME set
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7526 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 21, 2010
1 parent 6d327e0 commit 255b32f
Show file tree
Hide file tree
Showing 3 changed files with 913 additions and 963 deletions.
45 changes: 3 additions & 42 deletions OMShell/omcinteractiveenvironment.cpp
Expand Up @@ -116,52 +116,14 @@ namespace IAEX
try
{
// 2006-02-28 AF, use environment varable to find omc.exe
string OMCPath( getenv( "OPENMODELICAHOME" ) );
if( OMCPath.empty() )
throw std::runtime_error( "Could not find environment variable OPENMODELICAHOME" );

// location of omc in openmodelica folder
QDir dir;
#ifdef WIN32
if( dir.exists( QString(OMCPath.c_str()) + "\\bin\\omc.exe" ) )
OMCPath += "\\bin\\";
else if( dir.exists( QString(OMCPath.c_str()) + "\\omc.exe" ) )
OMCPath;
else if( dir.exists( "omc.exe" ))
OMCPath = "";
else
{
string msg = "Unable to find OMC, searched in:\n" +
OMCPath + "\\bin\\\n" +
OMCPath + "\n" +
dir.absolutePath().toStdString();

throw std::runtime_error( msg.c_str() );
}
#else /* unix */
if( dir.exists( QString(OMCPath.c_str()) + "/bin/omc" ) )
OMCPath += "/bin/";
else if( dir.exists( QString(OMCPath.c_str()) + "/omc" ) )
OMCPath;
else if( dir.exists( "omc.exe" ))
OMCPath = "";
else
{
string msg = "Unable to find OMC, searched in:\n" +
OMCPath + "/bin/\n" +
OMCPath + "\n" +
dir.absolutePath().toStdString();

throw std::runtime_error( msg.c_str() );
}
#endif
const char *omhome = getenv("OPENMODELICAHOME");

// 2006-03-14 AF, set omc loaction and parameters
QString omc;
#ifdef WIN32
omc = QString( OMCPath.c_str() ) + "omc.exe";
omc = QString( omhome ) + "bin/omc.exe";
#else /* unix */
omc = QString( OMCPath.c_str() ) + "omc";
omc = (omhome ? QString(omhome)+"bin/omc" : "omc");
#endif

QStringList parameters;
Expand All @@ -178,7 +140,6 @@ namespace IAEX
else
flag = false;


}
catch( exception &e )
{
Expand Down

0 comments on commit 255b32f

Please sign in to comment.