made windows work, without pipes yet though

This commit is contained in:
Sebastian Moser
2024-09-02 18:03:28 +02:00
parent 056c577b57
commit 26967ff26f
2 changed files with 30 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ path = "src/platform/os/main.rs"
required-features = [ "os-target" ] required-features = [ "os-target" ]
[features] [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" ] wasm-target = [ "wasm-bindgen", "console_error_panic_hook", "wasm-bindgen-cli" ]
async = ["tokio/net", "tokio", "tokio/rt-multi-thread", "tokio/io-util"] 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" tracing = "0.1.40"
serde_json = { version = "1.0.117", optional = false } serde_json = { version = "1.0.117", optional = false }
crossbeam = "0.8.4" crossbeam = "0.8.4"
toml = { version = "0.8.13", features = ["parse"], optional = false }
# buildin modules # buildin modules
#mize_module_blob = { path = "./modules/modules/Blob" } #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 } home = { version = "0.5.9", optional = true }
daemonize = { version = "0.5.0", optional = true } daemonize = { version = "0.5.0", optional = true }
nix = { version = "0.27.1", features = ["signal"], 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 } sysinfo = { version = "0.30.12", optional = true }
tracing-subscriber = { version = "0.3.18", optional = true } tracing-subscriber = { version = "0.3.18", optional = true }
tokio = { version = "1.21.0", features = ["sync"], optional = true } tokio = { version = "1.21.0", features = ["sync"], optional = true }

View File

@@ -14,13 +14,17 @@ use crate::error::{IntoMizeResult, MizeError, MizeResult};
use crate::item::{ItemData, IntoItemData}; use crate::item::{ItemData, IntoItemData};
use crate::memstore::MemStore; use crate::memstore::MemStore;
use crate::{mize_err, Module}; use crate::{mize_err, Module};
use crate::platform::os::unix_socket::UnixListener;
use crate::instance::module::EmptyModule; use crate::instance::module::EmptyModule;
use self::fsstore::FileStore; use self::fsstore::FileStore;
pub mod fsstore; pub mod fsstore;
#[cfg(target_family = "unix")]
mod unix_socket; mod unix_socket;
#[cfg(target_family = "unix")]
use crate::platform::os::unix_socket::UnixListener;
//mod web; //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 FileStore::store_is_opened(store_path.to_owned())? {
// if the store is already opened, connect to the instance, that opened it and join // if the store is already opened, connect to the instance, that opened it and join
// it's namespace // it's namespace
info!("CONNECTING");
unix_socket::connect(instance, store_path.into())?; #[cfg(target_family = "unix")]
return Ok(()); {
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 {
// else open it ourselves // 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))?; instance.migrate_to_store(Box::new(file_store))?;
let path = Path::new(&store_path).to_owned(); 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(()) Ok(())