diff options
author | Blaž Hrastnik | 2022-03-27 02:23:58 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-05-01 02:39:07 +0000 |
commit | 9191af3f8d73d2101c46192a4a80c41a19012320 (patch) | |
tree | a5259e9a819868317096ab3ca322fed24c2e7b97 /helix-loader/src | |
parent | 8bb89dafa2f3bae8d2c7605b880973992b04480f (diff) |
helix-loader + helix-core now compile for WASM
Diffstat (limited to 'helix-loader/src')
-rw-r--r-- | helix-loader/src/grammar.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index 9d63a2be..df88f24b 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -1,5 +1,4 @@ use anyhow::{anyhow, Context, Result}; -use libloading::{Library, Symbol}; use serde::{Deserialize, Serialize}; use std::fs; use std::time::SystemTime; @@ -17,6 +16,9 @@ const DYLIB_EXTENSION: &str = "so"; #[cfg(windows)] const DYLIB_EXTENSION: &str = "dll"; +#[cfg(target_arch = "wasm32")] +const DYLIB_EXTENSION: &str = "wasm"; + #[derive(Debug, Serialize, Deserialize)] struct Configuration { #[serde(rename = "use-grammars")] @@ -57,7 +59,14 @@ pub enum GrammarSource { const BUILD_TARGET: &str = env!("BUILD_TARGET"); const REMOTE_NAME: &str = "origin"; +#[cfg(target_arch = "wasm32")] +pub fn get_language(name: &str) -> Result<Language> { + unimplemented!() +} + +#[cfg(not(target_arch = "wasm32"))] pub fn get_language(name: &str) -> Result<Language> { + use libloading::{Library, Symbol}; let name = name.to_ascii_lowercase(); let mut library_path = crate::runtime_dir().join("grammars").join(&name); library_path.set_extension(DYLIB_EXTENSION); |