Repository navigation
Select one of several installed OpenModelica versions - #5
Merged
Merged
Conversation
The Windows installer is changed to allow several OpenModelica versions side by side (OpenModelica/OpenModelica#5809, OpenModelica/OpenModelicaSetup#96). OPENMODELICAHOME then points to the default one and each version sets OPENMODELICAHOME_<version>, with the characters of the version that are not letters or digits replaced by underscores (OPENMODELICAHOME_1_27_0). OMOctave(omcpath, version) takes the version as second argument and looks for OpenModelica in this order: 1. the omcpath argument 2. the version argument: OPENMODELICAHOME_<version>, or the newest installed version that starts with it ('1.27' for the newest 1.27.x) 3. on Windows, OPENMODELICAHOME 4. on Windows, the newest OPENMODELICAHOME_<version> 5. omc from PATH The session remembers its installation directory, and simulate() takes the DLL path on Windows from it instead of from OPENMODELICAHOME, which is the wrong one for a session started with omcpath or version. On Windows without OPENMODELICAHOME omc from PATH is started instead of /bin/omc.exe. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
adrpo
force-pushed
the
omhome-version
branch
from
November 17, 2026 23:48
c5253d0 to
91fca0b
Compare
Two problems found when running on Windows (Octave 11.3) with an installation in a directory with a space in its name, as the default C:\Program Files\OpenModelica<version> has (OpenModelica/OpenModelica#5809): - The path of omc was passed to START without quotes: Windows reported that it cannot find the part of the path before the space. - system(cmd) did not return while omc was running, so the constructor never got to read the port file. omc is now started with the async type of system. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
adrpo
marked this pull request as ready for review
November 18, 2026 08:35
adrpo
added a commit
to adrpo/OMMatlab
that referenced
this pull request
Nov 18, 2026
The path of omc was passed to START without quotes. With an installation in a directory with a space in its name, as the default C:\Program Files\OpenModelica<version> has, Windows reports that it cannot find the part of the path before the space (OpenModelica/OpenModelica#5809). Found with the same command in OMOctave (OpenModelica/OMOctave#5). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Client part of OpenModelica/OpenModelica#5809 (several OpenModelica versions installed side by side on Windows).
With OpenModelica/OpenModelicaSetup#96 the Windows installer keeps
OPENMODELICAHOMEfor the version selected as the default one and setsOPENMODELICAHOME_<version>for each installed version, with every character of the version that is not a letter or a digit replaced by an underscore, e.g.OPENMODELICAHOME_1_27_0.What changes
The constructor takes the version as a second argument:
OpenModelica is looked for in this order:
omcpathargumentversionargument; an error with the list of the installed versions if it is not installedOPENMODELICAHOMEOPENMODELICAHOME_<version>omcfrom thePATH"Newest" compares the numbers of the version: for the same
major.minor.patcha pre-release build (1.28.0-dev-…) is older than the release, which is older than a build after it (1.27.0-5-g…). The lookup functions are the same as in OpenModelica/OMMatlab#33, and the order is the one of OpenModelica/OMPython#490.Four fixes that come with it:
simulate()takes the DLL path on Windows from it. It usedOPENMODELICAHOME, which is the wrong installation for a session started withomcpath(and now withversion).OPENMODELICAHOME,omcfrom thePATHis started; before, the command was/bin/omc.exe.STARTcommand. Without the quotes an installation in a directory with a space in its name, as the defaultC:\Program Files\OpenModelica<version>has, was not started: Windows reported that it cannot find the part of the path before the space.asynctype ofsystem. With Octave 11.3system('START /b ...omc.exe ...')did not return while omc was running, so the constructor never got to read the port file.masterhangs in the same way there.Linux and macOS start
omcfrom thePATHas before unlessomcpathorversionis given.Testing
GNU Octave 10.3 on Linux:
bin/omc.exe(exact version, start of a version, version that is not installed, default, uninstalled default, newest, real environment variables).OMOctave('', '1.99')withOPENMODELICAHOME_1_99_0=/usrstarts/usr/bin/omc(the port file is created). The constructor then stops atpkg load zeromq, which I could not install, so no expression was sent.OMOctave('', '1.0')gives the error with the installed versions.GNU Octave 11.3 with zeromq 1.5.7 on Windows 11,
octave-cli, with an omc 1.28.0-dev built from source. Each session checksgetVersion()andgetInstallationDirectoryPath(), builds a bouncing ball model withModelicaSystem, runssimulate()and reads the result withgetSolutions:OPENMODELICAHOME_1_27_0(a directory with an emptybin\omc.exe) andOPENMODELICAHOME_1_28_0_dev_...pointing toC:\temp\omoct\OM 1.28(a junction to the real installation, with a space in the name), noOPENMODELICAHOME:OMOctave()andOMOctave('', '1.28')both run the 1.28 one;OMOctave('', '1.26')gives the error with the installed versions.OPENMODELICAHOMEpointing to a directory without omc plus the versioned variable: the versioned installation is used.OPENMODELICAHOME: used as before.PATH: omc from thePATHis used.OMOctave(omcpath)with the full path ofomc.exe(written with/and with\), without any variable and withOPENMODELICAHOMEpointing to a directory without omc: the given omc is used, as before. The same with the path through the junction with the space in its name.Not tested: the Octave GUI, and macOS.
🤖 Generated with Claude Code