ksud: Fix windows compile

This commit is contained in:
tiann
2023-02-21 21:39:14 +08:00
parent 82a304e054
commit e309a03515
2 changed files with 22 additions and 3 deletions

View File

@@ -31,13 +31,13 @@ rust-embed = { version = "6.4.2", features = [
"debug-embed",
"compression", # must clean build after updating binaries
] }
proc-mounts = "0.3"
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
sys-mount = { git = "https://github.com/tiann/sys-mount" }
# some android specific dependencies which compiles under unix are also listed here for convenience of coding
android-properties = { version = "0.2.2", features = ["bionic-deprecated"] }
procfs = "0.15"
proc-mounts = "0.3"
[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.13"

View File

@@ -1,7 +1,7 @@
use anyhow::Result;
use anyhow::{Ok, Result};
#[cfg(any(target_os = "linux", target_os = "android"))]
use anyhow::{Context, Ok};
use anyhow::Context;
#[cfg(any(target_os = "linux", target_os = "android"))]
use retry::delay::NoDelay;
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -260,9 +260,11 @@ impl StockOverlay {
#[derive(Debug)]
pub struct StockMount {
mnt: String,
#[cfg(any(target_os = "linux", target_os = "android"))]
mountlist: proc_mounts::MountList,
}
#[cfg(any(target_os = "linux", target_os = "android"))]
impl StockMount {
pub fn new(mnt: &str) -> Result<Self> {
let mountlist = proc_mounts::MountList::new()?;
@@ -322,3 +324,20 @@ impl StockMount {
Ok(())
}
}
#[cfg(not(any(target_os = "linux", target_os = "android")))]
impl StockMount {
pub fn new(mnt: &str) -> Result<Self> {
Ok(Self {
mnt: mnt.to_string(),
})
}
pub fn umount(&self) -> Result<()> {
unimplemented!()
}
pub fn remount(&self) -> Result<()> {
unimplemented!()
}
}