[go: nahoru, domu]

Skip to content

Commit

Permalink
Clean up implementation for unsupported targets
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokoch committed Apr 2, 2019
1 parent c629d48 commit 0e7480f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@
#[cfg(unix)] pub use self::unix::reflink;
#[cfg(windows)] mod windows;
#[cfg(windows)] pub use self::windows::reflink;
#[cfg(not(any(unix, windows)))] mod others;
#[cfg(not(any(unix, windows)))] pub use self::others::reflink;

fn _reflink_not_supported() -> std::io::Result<()> {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("Operation not supported on {}-{}-{}",
std::env::consts::ARCH,
std::env::consts::OS,
std::env::consts::FAMILY
),
));
}
6 changes: 6 additions & 0 deletions src/sys/others.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use std::io;
use std::path::Path;

pub fn reflink(_from: &Path, _to: &Path) -> io::Result<()> {
super::_reflink_not_supported()
}
7 changes: 2 additions & 5 deletions src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ pub fn reflink(from: &Path, to: &Path) -> io::Result<()> {
target_os = "macos",
target_os = "ios"
)))]
pub fn reflink(from: &Path, to: &Path) -> io::Result<()> {
return Err(io::Error::new(
io::ErrorKind::Other,
"Operation not supported",
));
pub fn reflink(_from: &Path, _to: &Path) -> io::Result<()> {
super::_reflink_not_supported()
}

0 comments on commit 0e7480f

Please sign in to comment.