Skip to content

Commit

Permalink
feat(plugin): update plugins path for testings
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Feb 24, 2021
1 parent 8f0958c commit 05bd602
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugin_manager/src/plugin_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ pub struct PluginManager {}

impl PluginManager {
pub fn run(plugin_name: &str, config: CocoConfig) {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let production_plugins = root.parent().unwrap().join("coco_plugins");
let root = PathBuf::from(".");
let production_plugins = root.join("coco_plugins");

let plugin_path;
let path;
if production_plugins.exists() {
plugin_path = Self::get_plugin_path(plugin_name, false);
let plugin_path = Self::get_plugin_path(plugin_name, true);
path = root.join(plugin_path);
} else {
plugin_path = Self::get_plugin_path(plugin_name, false);
let debug_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let plugin_path = Self::get_plugin_path(plugin_name, false);
// because cargo project settings
path = debug_root.parent().unwrap().join(plugin_path);
}

let path = root.parent().unwrap().join(plugin_path);
println!("search plugins in path: {:?}", path.display());

let cont: Container<Wrapper> =
unsafe { Container::load(path) }.expect("Could not open library or load symbols");
Expand Down

0 comments on commit 05bd602

Please sign in to comment.