diff --git a/Cargo.toml b/Cargo.toml index 08775df..5db0932 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ path = "src/platform/os/main.rs" required-features = [ "os-target" ] [features] -os-target = [ "clap", "home", "daemonize", "nix", "toml", "sysinfo", "ciborium/default", "tracing-subscriber", "async", "tracing-subscriber/env-filter", "libloading" ] +os-target = [ "clap", "home", "nix", "sysinfo", "ciborium/default", "tracing-subscriber", "async", "tracing-subscriber/env-filter", "libloading" ] wasm-target = [ "wasm-bindgen", "console_error_panic_hook", "wasm-bindgen-cli" ] async = ["tokio/net", "tokio", "tokio/rt-multi-thread", "tokio/io-util"] @@ -32,6 +32,7 @@ interner = { git = "https://github.com/c2vi/interner" } tracing = "0.1.40" serde_json = { version = "1.0.117", optional = false } crossbeam = "0.8.4" +toml = { version = "0.8.13", features = ["parse"], optional = false } # buildin modules #mize_module_blob = { path = "./modules/modules/Blob" } @@ -46,7 +47,6 @@ clap = { version = "4.4.11", features = ["cargo"], optional = true } home = { version = "0.5.9", optional = true } daemonize = { version = "0.5.0", optional = true } nix = { version = "0.27.1", features = ["signal"], optional = true } -toml = { version = "0.8.13", features = ["parse"], optional = true } sysinfo = { version = "0.30.12", optional = true } tracing-subscriber = { version = "0.3.18", optional = true } tokio = { version = "1.21.0", features = ["sync"], optional = true } diff --git a/src/platform/os/mod.rs b/src/platform/os/mod.rs index 02866aa..4df7d8b 100644 --- a/src/platform/os/mod.rs +++ b/src/platform/os/mod.rs @@ -14,13 +14,17 @@ use crate::error::{IntoMizeResult, MizeError, MizeResult}; use crate::item::{ItemData, IntoItemData}; use crate::memstore::MemStore; use crate::{mize_err, Module}; -use crate::platform::os::unix_socket::UnixListener; use crate::instance::module::EmptyModule; use self::fsstore::FileStore; pub mod fsstore; + +#[cfg(target_family = "unix")] mod unix_socket; + +#[cfg(target_family = "unix")] +use crate::platform::os::unix_socket::UnixListener; //mod web; @@ -80,9 +84,19 @@ pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { if FileStore::store_is_opened(store_path.to_owned())? { // if the store is already opened, connect to the instance, that opened it and join // it's namespace - info!("CONNECTING"); - unix_socket::connect(instance, store_path.into())?; - return Ok(()); + + #[cfg(target_family = "unix")] + { + info!("CONNECTING"); + use crate::platform::os::unix_socket; + unix_socket::connect(instance, store_path.into())?; + return Ok(()); + } + + #[cfg(target_family = "windows")] + { + warn!("CONNECTING... would connect, but that is not implemented on windows yet"); + } } else { // else open it ourselves @@ -90,7 +104,16 @@ pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { instance.migrate_to_store(Box::new(file_store))?; let path = Path::new(&store_path).to_owned(); - instance.add_listener(UnixListener::new(path)?)?; + + #[cfg(target_family = "unix")] + { + instance.add_listener(UnixListener::new(path)?)?; + } + + #[cfg(target_family = "windows")] + { + warn!("would add a Listener on a local socket, but that is not yet implemented for windows");; + } } Ok(())