diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs index 4e29d323c7..cc00aca981 100644 --- a/zellij-server/src/wasm_vm.rs +++ b/zellij-server/src/wasm_vm.rs @@ -29,7 +29,7 @@ use crate::{ }; use zellij_utils::{ - consts::{VERSION, ZELLIJ_PROJ_DIR, ZELLIJ_TMP_DIR}, + consts::{VERSION, ZELLIJ_CACHE_DIR, ZELLIJ_PROJ_DIR, ZELLIJ_TMP_DIR}, errors::{ContextType, PluginContext}, }; use zellij_utils::{ @@ -106,14 +106,7 @@ pub(crate) fn wasm_thread_main( .unwrap_or_else(|| panic!("Plugin {:?} could not be resolved", run)); let (instance, plugin_env) = start_plugin( - plugin_id, - client_id, - &plugin, - tab_index, - &bus, - &store, - &data_dir, - &plugin_global_data_dir, + plugin_id, client_id, &plugin, tab_index, &bus, &store, &data_dir, ); let mut main_user_instance = instance.clone(); @@ -204,16 +197,8 @@ pub(crate) fn wasm_thread_main( // load headless plugins for plugin in plugins.iter() { if let PluginType::Headless = plugin.run { - let (instance, plugin_env) = start_plugin( - plugin_id, - client_id, - plugin, - 0, - &bus, - &store, - &data_dir, - &plugin_global_data_dir, - ); + let (instance, plugin_env) = + start_plugin(plugin_id, client_id, plugin, 0, &bus, &store, &data_dir); headless_plugins.insert(plugin_id, (instance, plugin_env)); plugin_id += 1; } @@ -238,7 +223,6 @@ fn start_plugin( bus: &Bus, store: &Store, data_dir: &Path, - plugin_global_data_dir: &Path, ) -> (Instance, PluginEnv) { if plugin._allow_exec_host_cmd { info!( @@ -271,7 +255,7 @@ fn start_plugin( let output = Pipe::new(); let input = Pipe::new(); let stderr = LoggingPipe::new(&plugin.location.to_string(), plugin_id); - let plugin_own_data_dir = plugin_global_data_dir.join(Url::from(&plugin.location).to_string()); + let plugin_own_data_dir = ZELLIJ_CACHE_DIR.join(Url::from(&plugin.location).to_string()); fs::create_dir_all(&plugin_own_data_dir).unwrap_or_else(|e| { log::error!( "Could not create plugin_own_data_dir in {:?} \n Error: {:?}", diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index 494d12a20e..cd3180023f 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -53,6 +53,7 @@ lazy_static! { pub static ref ZELLIJ_TMP_DIR: PathBuf = PathBuf::from(format!("/tmp/zellij-{}", *UID)); pub static ref ZELLIJ_TMP_LOG_DIR: PathBuf = ZELLIJ_TMP_DIR.join("zellij-log"); pub static ref ZELLIJ_TMP_LOG_FILE: PathBuf = ZELLIJ_TMP_LOG_DIR.join("zellij.log"); + pub static ref ZELLIJ_CACHE_DIR: PathBuf = ZELLIJ_PROJ_DIR.cache_dir().to_path_buf(); } pub const FEATURES: &[&str] = &[