Repository navigation
Select one of several installed OpenModelica versions - #33
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). OMMatlab(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() and linearize() take 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>
This was referenced Nov 17, 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>
adrpo
marked this pull request as ready for review
November 19, 2026 07:40
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 same order and rules are used in OpenModelica/OMPython#490.Two fixes that come with it:
simulate()andlinearize()take the DLL path on Windows from it. They 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.Linux and macOS start
omcfrom thePATHas before unlessomcpathorversionis given.Testing
Not run in MATLAB, I have none available. The lookup functions (
versionEnvName,versionSortKey,installedVersions,locateOMHome) were run in GNU Octave 10.3 on Linux, loading thisOMMatlab.m: 28 checks with directories that contain an emptybin/omc.exe(exact version, start of a version, version that is not installed, default, uninstalled default, newest, real environment variables). The constructor,simulate()andlinearize()changes are untested. The PR is taken out of draft on the strength of the Octave run only: a run in MATLAB on Windows (default session, a session withversion,simulate()andlinearize(), an installation in a directory with a space in its name) is still missing.The path of omc is now quoted in the Windows
STARTcommand. Unquoted, an installation in a directory with a space in its name (as the defaultC:\Program Files\OpenModelica<version>has) is not started: Windows reports that it cannot find the part of the path before the space. That was seen with the same command in OpenModelica/OMOctave#5 on Windows 11, and the quoted command starts omc there; the MATLAB side of it is not run either.🤖 Generated with Claude Code