Skip to content

Commit

Permalink
Fix cp build on Redox
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Dec 9, 2017
1 parent a23a8ed commit 75141f0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cp/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<S
}

fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::PathBuf, dest: std::path::PathBuf, found_hard_link: &mut bool) -> CopyResult<()> {
// Redox does not currently support hard links
#[cfg(not(target_os = "redox"))]
{
if !source.is_dir() {
unsafe {
let src_path = CString::new(source.as_os_str().to_str().unwrap()).unwrap();
Expand Down Expand Up @@ -714,6 +717,7 @@ fn preserve_hardlinks(hard_links: &mut Vec<(String, u64)>, source: &std::path::P
}
}
}
}
Ok(())
}

Expand Down Expand Up @@ -826,7 +830,8 @@ fn copy_directory(root: &Path, target: &Target, options: &Options) -> CopyResult
}
}

#[cfg(windows)]
// This should be changed once Redox supports hardlinks
#[cfg(any(windows, target_os = "redox"))]
let mut hard_links: Vec<(String, u64)> = vec![];

for path in WalkDir::new(root) {
Expand Down

0 comments on commit 75141f0

Please sign in to comment.