Compare commits
1
Commits
aedd3e1692
...
17f31ea3e0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17f31ea3e0 |
@@ -36,6 +36,17 @@ namespace Echoion::Core
|
||||
{
|
||||
return "Echoion";
|
||||
}
|
||||
|
||||
// Void::Plugin::PluginLoader calls on_load() once after create
|
||||
// (first load and after a reload swap). Self-initialize from the
|
||||
// default config path so the plugin is ready without host-provided
|
||||
// wiring; idempotent via isInitialized().
|
||||
void on_load() override
|
||||
{
|
||||
if (!isInitialized()) {
|
||||
(void)initialize(ConfigLoader::getDefaultConfigPath());
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace Echoion::Core
|
||||
|
||||
@@ -103,6 +114,16 @@ extern "C"
|
||||
if (!core || !json) {
|
||||
return -1;
|
||||
}
|
||||
// reload() transfers state before on_load(), so the freshly-created
|
||||
// instance is not yet initialized — bring it up first, then restore.
|
||||
// Idempotent: a no-op once initialized.
|
||||
if (!core->isInitialized()) {
|
||||
auto initResult =
|
||||
core->initialize(Echoion::Core::ConfigLoader::getDefaultConfigPath());
|
||||
if (!initResult) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
auto result = core->restoreAfterHotReload(std::string(json));
|
||||
return result ? 0 : -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user