Skip to content

Find OpenModelica if several versions are installed - #5

Merged
adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:omhome-version
Nov 18, 2026
Merged

adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:omhome-version

Conversation

@adrpo

@adrpo adrpo commented Nov 18, 2026

Copy link
Copy Markdown
Member

Client part of OpenModelica/OpenModelica#5809 (several OpenModelica versions installed side by side on Windows).

With OpenModelica/OpenModelicaSetup#96 the Windows installer keeps OPENMODELICAHOME for the version selected as the default one and sets OPENMODELICAHOME_<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

With the preference "use OPENMODELICAHOME specified binary" MDT looked at OPENMODELICAHOME and then at the PATH. The new class org.modelica.mdt.omc.OMCHome looks for the installation in this order:

  1. OPENMODELICAHOME
  2. the newest OPENMODELICAHOME_<version>
  3. omc on the PATH
  • Without OPENMODELICAHOME_<version> variables OPENMODELICAHOME is used as it is, as before. With them, an OPENMODELICAHOME without an omc binary (left behind by an uninstalled version) is skipped.
  • "Newest" compares the numbers of the version, with the same rules as Select one of several installed OpenModelica versions OMPython#490.
  • The omc that MDT starts now always gets the OPENMODELICAHOME of its own installation. Before, that was only done when the variable was not set, so a custom binary of one version was started with the OPENMODELICAHOME of another one.
  • BreakProcess.exe (debugger, Windows) is looked up with the same lookup instead of OPENMODELICAHOME only.
  • The label of the preference and the help page (ch2.html) mention the versioned variables.

There is no new preference to select a version: a specific version is selected with "use custom binary", as before.

Testing

  • TestOMCHome (new, org.modelica.mdt.test): 8 tests of the lookup with a fake environment and directories with an empty bin/omc.exe. Compiled and run standalone with JUnit 4.13.2: all pass.
  • OMCProxy.java and MISession.java were only checked with javac without the Eclipse jars (no errors other than the missing Eclipse classes). The plugins were not built and MDT was not run with this change, on any platform, which is why this is a draft.

🤖 Generated with Claude Code

@adrpo adrpo self-assigned this Nov 18, 2026
adrpo added a commit to adrpo/OpenModelica that referenced this pull request Nov 18, 2026
MDT falls back to the newest OPENMODELICAHOME_<version> if
OPENMODELICAHOME is not set (OpenModelica#5809, OpenModelica/MDT#5).

Assisted-by: Claude Fable 5.2
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).

With "use OPENMODELICAHOME specified binary" MDT looked at
OPENMODELICAHOME and then at the PATH. The new OMCHome class looks for
the installation in this order:

1. OPENMODELICAHOME
2. the newest OPENMODELICAHOME_<version>
3. omc on the PATH

An OPENMODELICAHOME without an omc binary (left behind by an
uninstalled version) is skipped if versioned installations exist.

The omc that MDT starts now always gets the OPENMODELICAHOME of its own
installation, also when the variable is set to another installation and
a custom binary is used. BreakProcess.exe is looked up in the same
installation as omc.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@adrpo
adrpo marked this pull request as ready for review November 18, 2026 21:40
@adrpo
adrpo merged commit bc08037 into OpenModelica:master Nov 18, 2026
2 checks passed
adrpo added a commit to adrpo/OpenModelica that referenced this pull request Nov 19, 2026
MDT falls back to the newest OPENMODELICAHOME_<version> if
OPENMODELICAHOME is not set (OpenModelica#5809, OpenModelica/MDT#5).

Assisted-by: Claude Fable 5.2
adrpo added a commit to OpenModelica/OpenModelica that referenced this pull request Nov 19, 2026
* Document several OpenModelica versions on Windows

The Windows installer is changed to install different OpenModelica
versions side by side (#5809). OPENMODELICAHOME then points to the
version selected as the default one, and each installed version sets
OPENMODELICAHOME_<version>.

The User's Guide gets a section about this in the introduction: what
the installer does with the versions that are already installed, the
default installation, the environment variables and the installer
options. The OMPython, OMJulia and OMMatlab chapters describe how to
select a version, and the MDT chapter says which version it uses.

The command completion of the Rust OMShell looked for commands.xml
only in OPENMODELICAHOME, which is the default version and not always
the version that runs. It now looks in the installation of the
executable first.

Assisted-by: Claude Fable 5.2

* Say which version MDT uses without a default

MDT falls back to the newest OPENMODELICAHOME_<version> if
OPENMODELICAHOME is not set (#5809, OpenModelica/MDT#5).

Assisted-by: Claude Fable 5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant