Skip to content

Fix autoload always loading a plugin's main class file instead of a dedicated one - #3444

Open
Salvialf wants to merge 3 commits into
developfrom
fix/autoload-dedicated-plugin-class
Open

Fix autoload always loading a plugin's main class file instead of a dedicated one#3444
Salvialf wants to merge 3 commits into
developfrom
fix/autoload-dedicated-plugin-class

Conversation

@Salvialf

Copy link
Copy Markdown
Contributor

jeedomAutoload truncates an unresolved plugin class name (e.g. xxx_yyy) down to its plugin prefix (xxx) to check if the plugin is active, then reuses that truncated name as both the plugin folder and the file to load. This means it always loads the plugin's main class file, even when a dedicated file matching the exact class name exists in the plugin's core/class folder.

The fix checks for a file matching the exact class name first, and only falls back to the plugin's main class file if it doesn't exist. Fully backward compatible: plugins that never split a secondary class out keep the exact same behavior.

This also applies to the Cmd/Real suffix stripping done earlier in the function, so a plugin's xxxCmd class can now be extracted into its own dedicated file too, not just underscore-suffixed classes.

Also added type hints to jeedomAutoload and simplified it slightly (inlined single-use path variables) while working on it.

@Salvialf Salvialf added the changelog-fix Use to generate release notes / changelog To be apply on PR label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-fix Use to generate release notes / changelog To be apply on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants