Skip to content

Fixed Windows data path resolution and installer default folder - #9754

Merged
timosachsenberg merged 4 commits into
OpenMS:developfrom
aliviahossain:develop
Jul 20, 2026
Merged

timosachsenberg merged 4 commits into
OpenMS:developfrom
aliviahossain:develop

Conversation

@aliviahossain

@aliviahossain aliviahossain commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

@cbielow , @timosachsenberg On Windows the installer wrote an OPENMS_DATA_PATH environment variable and File::getOpenMSDataPath() checked that variable first. So a value left behind by an old or side by side install could quietly hijack data resolution for a newer version. On top of that, the install wizard defaulted to the folder of the previously installed version (for example a fresh 3.6.0 install still pointed at C:\Program Files\OpenMS-3.2.0).

Checklist

  • [ yes] Make sure that you are listed in the AUTHORS file
  • [ yes] Add relevant changes and new features to the CHANGELOG file
  • [ yes] I have commented my code, particularly in hard-to-understand areas
  • [ yes] New and existing unit tests pass locally with my changes
  • [ yes] Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

Resolution order

Before: OPENMS_DATA_PATH env var -> OPENMS_INSTALL_DATA_PATH -> compiled macro -> executable relative

After (Windows): compiled macro -> executable relative -> OPENMS_DATA_PATH env var (last)
After (Linux and macOS): OPENMS_INSTALL_DATA_PATH -> compiled macro -> executable relative -> OPENMS_DATA_PATH env var (last)

Before and after

Data path resolution with a stale OPENMS_DATA_PATH set to a different valid share:

Before: Data path follows the stale variable and points at the wrong share.
After: Data path resolves to the real share and Data path src is never the env var.

Installer, with an older 3.2.0 recorded in the registry while installing 3.6.0:

Before: wizard defaults to C:\Program Files\OpenMS-3.2.0.
After: wizard defaults to C:\Program Files\OpenMS-3.6.0. Same version reinstall or repair still reuses the stored folder.

Files changed:

  • src/openms/source/SYSTEM/File.cpp: reorder resolution, env var probed last, skip OPENMS_INSTALL_DATA_PATH on Windows, make the source getter public and update its one caller.
  • src/openms/include/OpenMS/SYSTEM/File.h: promote getOpenMSDataPathSource() to public.
  • src/topp/OpenMSInfo.cpp: print Data path src for diagnostics.
  • cmake/Windows/NSIS.template.in: stop writing OPENMS_DATA_PATH, keep the stale value cleanup on install and uninstall.
  • cmake/Windows/Include/NsisMultiUser.nsh: version gate the default install folder in both install modes.

Testing:

Built and run on Windows.

  • File_test passes (also covers the missing data file hint from 'CHEMISTRY/custom_mods.xml' could not be found #9636).
  • ParamXMLFile_test, UnimodXMLFile_test, ModificationsDB_test, ResidueDB_test pass with OPENMS_DATA_PATH unset, which proves devs and CI still find share on Windows through the compiled macro.
  • Data path before and after captured with OpenMSInfo.
  • Executable relative resolution confirmed on Windows.
  • Installer default folder confirmed with a minimal NSIS harness that reproduces the exact version gate branch, seeded with an old version in the registry.

Screenshots

Before, data path hijacked by a stale OPENMS_DATA_PATH:

Screenshot 2026-07-17 190518

After, stale OPENMS_DATA_PATH ignored, resolves to the real share:

Screenshot 2026-07-17 191443

After, executable relative resolution on Windows:

Screenshot 2026-07-17 191637

After, install wizard defaults to OpenMS-3.6.0 with an old 3.2.0 in the registry:

Screenshot 2026-07-17 192815

Notes:

  1. pyOpenMS keeps its env var fallback and is unchanged. It is not built in my local setup so it is verified by reasoning, but I have not run here.

  2. The legacy .onInit auto uninstall of a previous version and the version agnostic uninstall registry key are out of scope for this issue and left for a follow up.

Please review this PR, suggestions are most welcome and if everything is fine you may merge it.

Closes #9635

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows shared data-path resolution to be deterministic relative to the running executable; OPENMS_DATA_PATH is now only a last-resort fallback.
    • Avoided reusing an existing per-machine/per-user install folder when its stored version doesn’t match the current installer version.
    • Updated Windows installer behavior to stop setting/updating OPENMS_DATA_PATH in the registry.
  • Diagnostics

    • Updated OpenMSInfo to show the data-path resolution source for clearer troubleshooting.
    • Shared-data resolution error messages now include the resolved source details.

@github-actions

Copy link
Copy Markdown
Contributor

@aliviahossain The following names might be missing from the AUTHORS file:

  • aliviahossain

Please consider applying the following patch:

--- AUTHORS	2026-07-17 14:53:04.970465505 +0000
+++ AUTHORS.new	2026-07-17 14:53:10.571585727 +0000
@@ -14,6 +14,7 @@
  - Alexandra Scherbart
  - Alexandra Zerck
  - Alivia Hossain
+ - Alivia Hossain
  - Amanda Wein
  - Andreas Bertsch
  - Andreas Simon

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b05eb3f7-94ec-4b9c-b930-e0872d525a82

📥 Commits

Reviewing files that changed from the base of the PR and between 7bde7a1 and a192f82.

📒 Files selected for processing (4)
  • CHANGELOG
  • src/openms/include/OpenMS/SYSTEM/File.h
  • src/openms/source/SYSTEM/File.cpp
  • src/topp/OpenMSInfo.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/topp/OpenMSInfo.cpp
  • src/openms/include/OpenMS/SYSTEM/File.h
  • CHANGELOG
  • src/openms/source/SYSTEM/File.cpp

📝 Walkthrough

Walkthrough

OpenMS now resolves Windows shared data relative to the executable before consulting OPENMS_DATA_PATH. The installer stops setting that variable, validates installation-version reuse, and OpenMSInfo reports the data-path source.

Changes

Windows data path handling

Layer / File(s) Summary
Runtime resolution and diagnostics
src/openms/include/OpenMS/SYSTEM/File.h, src/openms/source/SYSTEM/File.cpp, src/topp/OpenMSInfo.cpp
Data-path probing uses compiled-in and executable-relative locations before the environment fallback. The resolution source is publicly exposed and displayed by OpenMSInfo and file-not-found diagnostics.
Installer path and environment handling
cmake/Windows/Include/NsisMultiUser.nsh, cmake/Windows/NSIS.template.in
Prior installation folders are reused only for matching versions, and the installer no longer writes OPENMS_DATA_PATH.
Release changelog update
CHANGELOG
Documents the Windows data-path and installer changes.

Sequence Diagram(s)

sequenceDiagram
  participant OpenMSInfo
  participant FileResolver
  participant Executable
  participant FileSystem
  participant Environment
  OpenMSInfo->>FileResolver: request data path
  FileResolver->>FileSystem: check compiled-in path
  FileResolver->>Executable: derive executable-relative path
  Executable->>FileSystem: check share/OpenMS
  FileResolver->>Environment: use OPENMS_DATA_PATH if needed
  FileResolver-->>OpenMSInfo: return path source
Loading

Possibly related PRs

  • OpenMS/OpenMS#9650: Updates related File::find data-path provenance and error reporting.
  • OpenMS/OpenMS#9652: Updates the shared-data file-not-found hint with the resolved data directory and its source.

Poem

I’m a bunny with paths in a neat little row,
Beside the executable, the data will go.
No stale environment shadows the way,
The installer picks the right version today.
OpenMSInfo tells where paths came to be—
Hop, hop, diagnostics, clear as can be!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main Windows installer and data-path fix.
Linked Issues check ✅ Passed The installer now defaults to the current version's folder and reuses only same-version installs, matching #9635.
Out of Scope Changes check ✅ Passed The data-path resolution and diagnostics updates are tightly related to the Windows install fix and do not add unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #9635

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/openms/include/OpenMS/SYSTEM/File.h (1)

228-231: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Format the documentation using Doxygen @brief tags.

As per coding guidelines, Doxygen documentation for C++ headers should use the /** @brief ... */ format with a blank line before details, rather than the /// style.

♻️ Proposed refactor
-    /// Returns a human-readable description of where getOpenMSDataPath() resolved from
-    /// (e.g. "the executable location (../share/OpenMS)"). Useful for diagnostics.
+    /**
+      `@brief` Returns a human-readable description of where getOpenMSDataPath() resolved from
+
+      (e.g. "the executable location (../share/OpenMS)"). Useful for diagnostics.
+    */
     static const std::string& getOpenMSDataPathSource();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openms/include/OpenMS/SYSTEM/File.h` around lines 228 - 231, Update the
Doxygen comment for getOpenMSDataPathSource() to use the /** `@brief` ... */
format, preserving the existing description and example details after a blank
line.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/openms/include/OpenMS/SYSTEM/File.h`:
- Around line 228-231: Update the Doxygen comment for getOpenMSDataPathSource()
to use the /** `@brief` ... */ format, preserving the existing description and
example details after a blank line.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 64904b82-3c03-4252-a116-11ebe2f30cba

📥 Commits

Reviewing files that changed from the base of the PR and between 51c6e69 and 4bac442.

📒 Files selected for processing (6)
  • CHANGELOG
  • cmake/Windows/Include/NsisMultiUser.nsh
  • cmake/Windows/NSIS.template.in
  • src/openms/include/OpenMS/SYSTEM/File.h
  • src/openms/source/SYSTEM/File.cpp
  • src/topp/OpenMSInfo.cpp

@aliviahossain

Copy link
Copy Markdown
Contributor Author

@timosachsenberg Can you please review this PR if you have time ? Thanks !

@timosachsenberg
timosachsenberg requested a review from cbielow July 20, 2026 06:07

@cbielow cbielow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. Thanks for providing screenshots and a local build.

Just one minor comment about formatting in OpenMSInfo (see below) and the screenshot of the installer:
The installation path when running the installer points to OpenMS-3.2 for an OpenMS 3.6 installer (in your screenshot). That is supposed to be fixed now, right?

Comment thread src/topp/OpenMSInfo.cpp Resolved
…#9635)

Address review feedback on OpenMS#9754:
- OpenMSInfo prints the data path and its source on a single line:
  "Data path : <path> (via <source>)".
- Shorten the data-path source tags so they read well inline
  (e.g. "OPENMS_DATA_PATH env", "exe-relative (../share/OpenMS)").
- File.h: use Doxygen @brief for getOpenMSDataPathSource(); fix the
  getOpenMSDataPath() comment (the env var is now a last-resort fallback,
  not an override).
- File.cpp: reword the file-not-found hint to match the new resolution order.
- CHANGELOG: clarify that probing OPENMS_DATA_PATH last applies on all
  platforms, with the Windows-specific changes called out separately.
@aliviahossain

Copy link
Copy Markdown
Contributor Author

Thanks! Fixed both. @cbielow

For the OpenMSInfo formatting, I collapsed it to the single line you suggested and shortened the source strings so they read well inline:

Data path : C:/.../share/OpenMS (via OPENMS_DATA_PATH env)

On the installer: good catch, I just overlooked it, that 3.2.0 shot was actually the pre-fix behaviour. I re-ran the harness with a stale 3.2.0 entry seeded in the registry, and with the version gate ($PerMachineInstallationVersion == "${VERSION}") it now falls back to the default OpenMS-3.6.0 instead of reusing the old folder. New screenshots are here:

Screenshot 2026-07-20 151753 Screenshot 2026-07-20 152331

Pushed a new single commit to this PR.

@cbielow cbielow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great.
Thanks!

@cbielow
cbielow enabled auto-merge (rebase) July 20, 2026 11:06
@timosachsenberg
timosachsenberg disabled auto-merge July 20, 2026 18:02
@timosachsenberg
timosachsenberg merged commit bd88cae into OpenMS:develop Jul 20, 2026
38 checks passed
@timosachsenberg

Copy link
Copy Markdown
Contributor

🙏

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.

The windows installer is defaulting to the path

3 participants