Skip to content

Commit

Permalink
ticket:5943 kill OPENMODELICAHOME from OMNotebook and OMShell
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed May 14, 2020
1 parent eb234c0 commit 01ec712
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion OMNotebook/OMNotebook/OMNotebookGUI/OMNotebook.config.in
Expand Up @@ -4,7 +4,7 @@ QMAKE_LINK = @CXX@

PLOTLIBS = -L@OPENMODELICAHOME@/lib/@host_short@/omc -lOMPlot -lomqwt @RPATH_QMAKE@
PLOTINC = @OPENMODELICAHOME@/include/omplot/qwt @OPENMODELICAHOME@/include/omplot
OMCLIBS = -L@OPENMODELICAHOME@/lib/@host_short@/omc -lOpenModelicaCompiler -lOpenModelicaRuntimeC -lfmilib_shared -lModelicaExternalC -lomcgc -lomantlr3
OMCLIBS = -L@OPENMODELICAHOME@/lib/@host_short@/omc -lOpenModelicaCompiler -lOpenModelicaRuntimeC -lomcruntime -lfmilib_shared -lModelicaExternalC -lomcgc -lomantlr3
OMCINC = @OPENMODELICAHOME@/include/omc/c

QMAKE_CFLAGS = @CFLAGS@ @CPPFLAGS@
Expand Down
2 changes: 1 addition & 1 deletion OMNotebook/OMNotebook/OMNotebookGUI/OMNotebookGUI.pro
Expand Up @@ -157,7 +157,7 @@ win32 {
PLOTLIBS = -L$$(OMBUILDDIR)/build/lib/omc -lOMPlot -lomqwt
PLOTINC = $$(OMBUILDDIR)/include/omplot \
$$(OMBUILDDIR)/include/omplot/qwt
OMCLIBS = -L$$(OMBUILDDIR)/lib/omc -lOpenModelicaCompiler -lOpenModelicaRuntimeC -lfmilib -lModelicaExternalC -lomcgc -lpthread
OMCLIBS = -L$$(OMBUILDDIR)/lib/omc -lOpenModelicaCompiler -lomcruntime -lOpenModelicaRuntimeC -lfmilib -lModelicaExternalC -lomcgc -lpthread
OMCINC = $$(OMBUILDDIR)/include/omc/c
} else {
include(OMNotebook.config)
Expand Down
30 changes: 10 additions & 20 deletions OMNotebook/OMNotebook/OMNotebookGUI/cellapplication.cpp
Expand Up @@ -49,6 +49,8 @@

#include <cstdlib>

#include "../../../OMCompiler/Compiler/runtime/settingsimpl.h"

namespace IAEX
{
/*!
Expand Down Expand Up @@ -115,17 +117,14 @@ namespace IAEX
app_ = new MyApp(argc, argv, this);


const char *omhome = getenv("OPENMODELICAHOME");
#ifdef WIN32
if (!omhome) {
QMessageBox::critical(0, tr("Error"), tr("OPENMODELICAHOME not set"), "OK");
const char *installationDirectoryPath = SettingsImpl__getInstallationDirectoryPath();
if (!installationDirectoryPath) {
QMessageBox::critical(0, tr("Error"), tr("Could not find installation directory path. Please make sure OpenModelica is installed properly."), "OK");
app_->quit();
exit(1);
}
#else /* unix */
omhome = omhome ? omhome : CONFIG_DEFAULT_OPENMODELICAHOME;
#endif
QString translationDirectory = omhome + QString("/share/omnotebook/nls");

QString translationDirectory = installationDirectoryPath + QString("/share/omnotebook/nls");
// install Qt's default translations
#ifdef Q_OS_WIN
qtTranslator.load("qt_" + QLocale::system().name(), translationDirectory);
Expand All @@ -150,19 +149,9 @@ namespace IAEX
setlocale(LC_NUMERIC, "C");

/* Don't move this line
* Is importat for threadData initialization
* Is important for threadData initialization
*/
OmcInteractiveEnvironment *env = OmcInteractiveEnvironment::getInstance(threadData);

// 2006-04-10 AF, use environment variable to find xml files
QString openmodelica = OmcInteractiveEnvironment::OpenModelicaHome();

if(!QDir().exists(openmodelica))
{
QMessageBox::critical( 0, "OpenModelica Error", tr("The environment variable OPENMODELICAHOME=%1 is not a valid directory").arg(openmodelica) );
exit(1);
}

// Avoid cluttering the whole disk with omc temp-files
env->evalExpression("setCommandLineOptions(\"+d=shortOutput\")");
QString cmdLine = env->getResult();
Expand All @@ -181,7 +170,8 @@ namespace IAEX
}

// 2005-12-17 AF, Create instance (load styles) of stylesheet
// 2006-04-10 AF, use environment variable to find stylesheet.xml
// 2006-04-10 AF, use installation directory path to find stylesheet.xml
QString openmodelica = QString(installationDirectoryPath);
try
{
QString stylesheetfile;
Expand Down
2 changes: 1 addition & 1 deletion OMShell/OMShell/OMShellGUI/oms.cpp
Expand Up @@ -263,7 +263,7 @@ OMS::OMS( QWidget* parent )
// create command compleation instance
QString openmodelica( delegate_->OpenModelicaHome() );
if( openmodelica.isEmpty() )
QMessageBox::critical( 0, "OMShell Error", "Could not find environment variable OPENMODELICAHOME, command completion will not work" );
QMessageBox::critical( 0, "OMShell Error", "Could not find installation directory path, command completion will not work. Please make sure OpenModelica is installed properly." );

try
{
Expand Down

0 comments on commit 01ec712

Please sign in to comment.