Voxa file system

This commit is contained in:
2025-08-29 15:07:15 +02:00
parent 87caa22a5a
commit b3a1c0bcff
4 changed files with 54 additions and 11 deletions
+7 -4
View File
@@ -1,3 +1,5 @@
use std::path::Path;
#[cfg(feature = "loader")]
use wasmtime::{Instance, Store};
#[cfg(feature = "loader")]
@@ -6,6 +8,7 @@ use wasmtime_wasi::preview1::WasiP1Ctx;
#[cfg(feature = "loader")]
pub mod loader;
pub mod macros;
pub mod vfs;
pub use anyhow::Result;
@@ -37,15 +40,15 @@ impl PluginApi for PluginInstance {
}
impl ServerConfig {
pub fn start(&self) -> Result<()> {
pub fn start(&self, root: &Path) -> Result<()> {
let mut plugins: Vec<PluginInstance> = Vec::new();
#[cfg(feature = "loader")]
loader::load_plugins(&mut plugins, std::path::Path::new("./plugins"));
loader::load_plugins(&mut plugins, &root.join("./plugins"))?;
self.start_with(plugins)
self.start_with(plugins, root)
}
pub fn start_with(&self, mut plugins: Vec<PluginInstance>) -> Result<()> {
pub fn start_with(&self, mut plugins: Vec<PluginInstance>, root: &Path) -> Result<()> {
for plugin in &mut plugins {
plugin.init();
}