Opened 5 years ago
Closed 5 years ago
#5954 closed defect (fixed)
More homogeneous handling of Settings
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | 1.16.0 |
Component: | Interactive Environment | Version: | |
Keywords: | Cc: | Niklas Worschech |
Description
Currently we have different handling of settings in Linux and Windows:
SettingsImpl__getInstallationDirectoryPath
returns%OPENMODELICAHOME%
in Windows and the dll location in Linux/MacSettingsImpl__getModelicaPath
returns%OPENMODELICALIBRARY%
in Windows and (dll location)/../lib/omlibrary in Linux/Mac- environment variabels used in the paths are not replaced
This ticket is to solve these problems:
- use the same in Windows as in Linux
- replace environment variables in the returned strings
Change History (12)
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 5 years ago
Cc: | added |
---|
comment:3 by , 5 years ago
comment:4 by , 5 years ago
I am using different OpenModelica versions on Linux and Windows. At the moment I always set these variables before I run the omc:
On Windows:
set OMDEV=D:/OpenModelica/OMDev set OPENMODELICAHOME=%OMHOME%/build set OPENMODELICALIBRARY=%OMHOME%/build/lib/omlibrary set PATH=%PATH%;%OMHOME%/build/bin; set OMLIBRARYCOMMON=%OMHOME%/testsuite/simulation/libraries/common/ set REFERENCEFILES=%OMHOME%/testsuite/ReferenceFiles/
On Linux:
export OPENMODELICAHOME=~/omc/omc-dev/build export OMLIBRARYCOMMON=~/omc/omc-dev/testsuite/simulation/libraries/common/ export PATH=~/omc/omc-dev/build/bin:$PATH
The modelica path I do not set. Is there a settings variable missing?
comment:5 by , 5 years ago
@adrpo Does your proposal mean you can switch the omc version via the c-api?
comment:6 by , 5 years ago
Yes, if you can unload the libOpenModelicaCompiler.dll and then load another one.
comment:7 by , 5 years ago
ok, I think your proposal is fine for us. I can test it work after you changed the handling.
comment:8 by , 5 years ago
The only issue that remains is how to find the OpenModelica installation if there is no OPENMODELICAHOME
environment variable. We could probably have something like Visual Studio used $(VS140COMNTOOLS)
, include the version number in the variable. I wonder how OMPython finds OpenModelica in Linux if there is no OPENMODELICAHOME
set.
Truth is that if we install OpenModelica in a common place such as Program Files
we could probably find all the versions that are present there.
comment:10 by , 5 years ago
On Linux, the other tools first look for env.var OPENMODELICAHOME and if it does not exist, it uses the PATH.
On Windows, you could use the registry. But it's annoying to search it for the clients, I think.
I think OPENMODELICAHOME should never need to be used for the omc executable (it's almost always causing problems by using a different runtime than the expected one).
The library path could be used as env.var. to override the default library path if needed though.
comment:11 by , 5 years ago
More fixes on Windows:
https://github.com/OpenModelica/OpenModelica/pull/893
I don't think reading OPENMODELICALIBRARY
is a good idea for now as in Windows, older installations does set it, so it would point to older installations even for newer ones.
comment:12 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Niklas, I know you're using setting of
OPENMODELICAHOME
andOPENMODELICALIBRARY
to set a specific place for the OpenModelica home. I want to change this behavior but also want to support your use case.My proposal is that if you call:
SettingsImpl__setInstallationDirectoryPath(installPath)
thenSettingsImpl__getInstallationDirectoryPath
returns thisinstallPath
.SettingsImpl__setModelicaPath(modelicaPath
thenSettingsImpl__getModelicaPath
returns thismdoelicaPath
Will this work fine for you? I guess you can just call these functions in main to set your installation to whatever paths you need.