Make mount no-op on unsupported targets

This commit is contained in:
oupson 2022-10-10 11:16:18 +02:00
parent 4a7d489ff4
commit 7bdfcd6ca8
Signed by: oupson
GPG Key ID: 3BD88615552EFCB7
4 changed files with 13 additions and 1 deletions

View File

@ -5,3 +5,7 @@ members = [
"rustcryptfs-fuse",
"rustcryptfs-mount"
]
[profile.release]
lto = true
codegen-units = 1

View File

@ -9,6 +9,10 @@ An implementation of [gocryptfs](https://github.com/rfjakob/gocryptfs) in Rust.
- [ ] read
- [ ] write
## Features
- mount\
Allow to mount a virtual filesystem on linux or windows (unimplemented). This feature is no-op on other targets.
## License
Licensed under either of

View File

@ -19,6 +19,7 @@ pub(crate) enum Commands {
Ls(LsCommand),
#[cfg(feature = "mount")]
#[cfg(any(target_os = "linux", target_os = "windows"))]
/// Mount an encrypted folder
Mount(MountCommand),
}
@ -52,6 +53,7 @@ pub(crate) struct LsCommand {
}
#[cfg(feature = "mount")]
#[cfg(any(target_os = "linux", target_os = "windows"))]
#[derive(Debug, Parser)]
pub(crate) struct MountCommand {
/// The directory

View File

@ -10,6 +10,7 @@ use args::{DecryptCommand, LsCommand};
use rustcryptfs_lib::GocryptFs;
#[cfg(feature = "mount")]
#[cfg(any(target_os = "linux", target_os = "windows"))]
use args::MountCommand;
mod args;
@ -22,6 +23,7 @@ fn main() -> anyhow::Result<()> {
args::Commands::Decrypt(c) => decrypt_file(c),
args::Commands::Ls(c) => ls(c),
#[cfg(feature = "mount")]
#[cfg(any(target_os = "linux", target_os = "windows"))]
args::Commands::Mount(c) => mount(c),
}
}
@ -135,7 +137,7 @@ fn mount(mount: &MountCommand) -> anyhow::Result<()> {
Ok(())
}
#[cfg(not(target_os = "linux"))]
#[cfg(target_os = "windows")]
#[cfg(feature = "mount")]
fn mount(mount: &MountCommand) -> anyhow::Result<()> {
unimplemented!()