diff options
author | har7an <99636919+har7an@users.noreply.github.com> | 2022-12-09 09:17:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 10:17:28 +0100 |
commit | 36233439f930f0c50bed574e95ff4cd887893120 (patch) | |
tree | 6af721edcc5ae920c22f102c22cde4b9adbfdf19 /zellij-utils/src | |
parent | 66593ec41a1c11ed134d729e9dea291e4c4cd38f (diff) |
HOTFIX: Feature/ignore asset map (#2002)
* utils: feature-gate asset map
to make publishing on crates.io possible without compile errors.
* setup: Fix asset_map feature
Diffstat (limited to 'zellij-utils/src')
-rw-r--r-- | zellij-utils/src/consts.rs | 4 | ||||
-rw-r--r-- | zellij-utils/src/input/plugins.rs | 6 | ||||
-rw-r--r-- | zellij-utils/src/setup.rs | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs index d8b60e351..328be223b 100644 --- a/zellij-utils/src/consts.rs +++ b/zellij-utils/src/consts.rs @@ -35,10 +35,10 @@ pub const FEATURES: &[&str] = &[ "disable_automatic_asset_installation", ]; -#[cfg(not(target_family = "wasm"))] +#[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] pub use not_wasm::*; -#[cfg(not(target_family = "wasm"))] +#[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] mod not_wasm { use lazy_static::lazy_static; use std::collections::HashMap; diff --git a/zellij-utils/src/input/plugins.rs b/zellij-utils/src/input/plugins.rs index 1ab3e831f..7503f43b0 100644 --- a/zellij-utils/src/input/plugins.rs +++ b/zellij-utils/src/input/plugins.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; use url::Url; use super::layout::{RunPlugin, RunPluginLocation}; -#[cfg(not(target_family = "wasm"))] +#[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] use crate::consts::ASSET_MAP; pub use crate::data::PluginTag; use crate::errors::prelude::*; @@ -129,7 +129,7 @@ impl PluginConfig { for path in paths { // Check if the plugin path matches an entry in the asset map. If so, load it directly // from memory, don't bother with the disk. - #[cfg(not(target_family = "wasm"))] + #[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] if !cfg!(feature = "disable_automatic_asset_installation") && self.is_builtin() { let asset_path = PathBuf::from("plugins").join(path); if let Some(bytes) = ASSET_MAP.get(&asset_path) { @@ -160,7 +160,7 @@ impl PluginConfig { } // Not reached if a plugin is found! - #[cfg(not(target_family = "wasm"))] + #[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] if self.is_builtin() { // Layout requested a builtin plugin that wasn't found let plugin_path = self.path.with_extension("wasm"); diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index ddbc59673..5de536c71 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -1,4 +1,4 @@ -#[cfg(not(target_family = "wasm"))] +#[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] use crate::consts::ASSET_MAP; use crate::input::theme::Themes; use crate::{ @@ -175,7 +175,7 @@ pub fn dump_specified_layout(layout: &str) -> std::io::Result<()> { } } -#[cfg(not(target_family = "wasm"))] +#[cfg(all(not(target_family = "wasm"), feature = "asset_map"))] pub fn dump_builtin_plugins(path: &PathBuf) -> Result<()> { for (asset_path, bytes) in ASSET_MAP.iter() { let plugin_path = path.join(asset_path); @@ -205,7 +205,7 @@ pub fn dump_builtin_plugins(path: &PathBuf) -> Result<()> { Ok(()) } -#[cfg(target_family = "wasm")] +#[cfg(any(target_family = "wasm", not(feature = "asset_map")))] pub fn dump_builtin_plugins(_path: &PathBuf) -> Result<()> { Ok(()) } |