feat(catalog): scan an ordered list of plugin folders with dedup-by-id#137
Merged
Conversation
Add PluginRuntimeCatalog::setPluginDirs() so the host can configure an ordered list of plugin directories. scanDirectory() and reload() now scan every configured directory in order and de-duplicate by manifest id: when the same plugin id appears in more than one folder, the first (highest-priority) folder wins and the later copies are skipped with an info diagnostic. The single-directory API (setPluginDir/ctor) is preserved and maps to a one-element list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add two cases to plugin_catalog_test: the same plugin id in two folders loads once from the first (higher-priority) folder; distinct ids across folders all load. Links the test against pj_plugin_runtime_catalog. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The RuntimeCatalogDedupsDuplicateIdFirstFolderWins assertion used a substring match of dir_a.string() against the loaded plugin path, which failed on Windows (slash/drive-case/canonicalisation differences) even though the dedup is correct. Compare at the filesystem level with std::filesystem::equivalent(winner.parent_path(), dir_a) instead. Also applies clang-format (the prior commit skipped the submodule hook). Co-Authored-By: Claude Opus 4.8 <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.
What
Adds
PluginRuntimeCatalog::setPluginDirs()so the host can configure an ordered list of plugin directories.scanDirectory()andreload()now scan every configured directory in order and de-duplicate by manifestid: when the same plugin id appears in more than one folder, the first (highest-priority) folder wins and the later copies are skipped with an info diagnostic.The existing single-directory API (
setPluginDir/ the constructor) is preserved and maps to a one-element list, so existing callers are unaffected.Why
PlotJuggler 4 is adding a user-configurable plugin-folder hierarchy (custom folders >
--plugin-dir> marketplace dir ><exe>/plugins). The host assembles the ordered list and needs the catalog to scan it with first-wins dedup. The dedup is cheap becauseinspectPluginDso()already reads the manifestidbefore committing to load.Versioning
No version bump in this PR — more PRs will land before the next version upgrade. For the record: this is an additive host-side API change (new
setPluginDirs), with no plugin-ABI vtable/struct change (abi/baseline.abiunchanged), so it is MINOR-eligible whenever the version is next bumped.Test
Exercised via the PlotJuggler 4 host build; single-directory behavior unchanged.
🤖 Generated with Claude Code