Skip to content

Commit

Permalink
Add default feature to enable mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Sep 11, 2023
1 parent 6a26fb7 commit 3505576
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 4 additions & 0 deletions ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ tracing = { workspace = true }

[dev-dependencies]
rmp-serde = { workspace = true }

[features]
default = ["mount"]
mount = ["ouisync-vfs/mount"]
15 changes: 9 additions & 6 deletions vfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ tracing = { workspace = true }
thiserror = { workspace = true }

[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
fuser = "0.13.0"
libc = "0.2.139"
fuser = { version = "0.13.0", optional = true }
libc = { version = "0.2.139", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
# Patch to force compilation of dokan2.dll when `DOKAN_DLL_OUTPUT_PATH` is
# defined even if dokan is installed.
# https://github.com/dokan-dev/dokan-rust/pull/7
dokan = { git = "https://github.com/inetic/dokan-rust", branch = "env-to-recompile-dll" }
dokan-sys = { git = "https://github.com/inetic/dokan-rust", branch = "env-to-recompile-dll" }
widestring = "0.4.3"
winapi = { version = "0.3.9", features = ["ntstatus", "winnt"] }
dokan = { git = "https://github.com/inetic/dokan-rust", branch = "env-to-recompile-dll", optional = true }
dokan-sys = { git = "https://github.com/inetic/dokan-rust", branch = "env-to-recompile-dll", optional = true }
widestring = { version = "0.4.3", optional = true }
winapi = { version = "0.3.9", features = ["ntstatus", "winnt"], optional = true }

[dev-dependencies]
criterion = { version = "0.4", features = ["html_reports"] }
Expand All @@ -42,3 +42,6 @@ tempfile = "3.2"
test-strategy = "0.2.1"
tracing-subscriber = { workspace = true, features = [ "env-filter" ] }

[features]
default = ["mount"]
mount = ["fuser", "libc", "dokan", "dokan-sys", "widestring", "winapi"]
12 changes: 6 additions & 6 deletions vfs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#[cfg(target_os = "linux")]
#[cfg(all(feature = "mount", target_os = "linux"))]
mod fuse;

#[cfg(target_os = "linux")]
#[cfg(all(feature = "mount", target_os = "linux"))]
pub use fuse::{mount, MountGuard, MultiRepoVFS};

#[cfg(target_os = "windows")]
#[cfg(all(feature = "mount", target_os = "windows"))]
mod dokan;

#[cfg(target_os = "windows")]
#[cfg(all(feature = "mount", target_os = "windows"))]
pub use crate::dokan::{
multi_repo_mount::MultiRepoVFS,
single_repo_mount::{mount, MountGuard},
};

#[cfg(not(any(target_os = "linux", target_os = "windows")))]
#[cfg(not(all(feature = "mount", any(target_os = "linux", target_os = "windows"))))]
mod dummy;

#[cfg(not(any(target_os = "linux", target_os = "windows")))]
#[cfg(not(all(feature = "mount", any(target_os = "linux", target_os = "windows"))))]
pub use dummy::{mount, MountGuard, MultiRepoVFS};

#[cfg(test)]
Expand Down

0 comments on commit 3505576

Please sign in to comment.