Voxa file system
This commit is contained in:
+7
-4
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user