Fix compilation on other target than linux

This commit is contained in:
oupson 2022-10-10 11:03:31 +02:00
parent 37d1955da7
commit 4a7d489ff4
Signed by: oupson
GPG Key ID: 3BD88615552EFCB7
4 changed files with 13 additions and 6 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
/target
*.py
enc
mount
mount
.cargo

View File

@ -7,8 +7,10 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
fuser = { version = "0.11", default-features = false }
log = "0.4"
rustcryptfs-lib = { path = "../rustcryptfs-lib" }
thiserror = "1.0"
libc = "0.2"
libc = "0.2"
[target.'cfg(target_os = "linux")'.dependencies]
fuser = { version = "0.11", default-features = false }

View File

@ -1,6 +1,10 @@
#[cfg(target_os = "linux")]
mod encrypted_filesystem;
#[cfg(target_os = "linux")]
mod inode_cache;
#[cfg(target_os = "linux")]
pub mod error;
pub use encrypted_filesystem::EncryptedFs;
#[cfg(target_os = "linux")]
pub use encrypted_filesystem::EncryptedFs;

View File

@ -1,12 +1,12 @@
use std::path::Path;
use rustcryptfs_fuse::EncryptedFs;
#[cfg(target_os = "linux")]
pub fn mount<P>(path: P, mount_point: P, password: &str) -> rustcryptfs_fuse::error::Result<()>
where
P: AsRef<Path>,
{
use rustcryptfs_fuse::EncryptedFs;
let fs = EncryptedFs::new(path, password)?;
fs.mount(mount_point)?;