santui_core/app/registry.rs
1use crate::plugin::PluginFactory;
2use std::path::{Path, PathBuf};
3
4use super::Santui;
5
6impl Santui {
7 /// Set the santui data directory (e.g. `~/.santui`).
8 /// Called from main.rs before `run()`.
9 pub fn set_data_dir(&mut self, dir: PathBuf) {
10 self.plugin_manager.set_data_dir(dir);
11 }
12
13 /// Set the plugin factory (called from main.rs before run()).
14 /// Used by PluginManager for hot-reload and on-demand plugin creation.
15 pub fn set_plugin_factory(&mut self, factory: PluginFactory) {
16 self.plugin_manager.set_factory(factory);
17 }
18
19 /// Register a default plugin (bundled with santui, e.g. the registry plugin).
20 /// The plugin is created via the factory and registered without initialising.
21 /// It will be initialised during `init_all` in `run()`.
22 pub fn register_default_plugin(&mut self, id: &str, name: &str, path: &Path) {
23 self.plugin_manager.register_new(id, name, path);
24 }
25}