#[cfg(unix)]
use std::os::unix::fs::symlink as symlink;
#[cfg(windows)]
- use std::os::unix::fs::symlink_dir as symlink;
+ use std::os::windows::fs::symlink_dir as symlink;
let project = git::new("foo", |project| {
project
}
#[cargo_test]
-#[cfg(unix)]
fn broken_symlink() {
- use std::os::unix::fs;
+ #[cfg(unix)]
+ use std::os::unix::fs::symlink as symlink;
+ #[cfg(windows)]
+ use std::os::windows::fs::symlink_dir as symlink;
let p = project()
.file(
)
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
.build();
- t!(fs::symlink("nowhere", &p.root().join("src/foo.rs")));
+ t!(symlink("nowhere", &p.root().join("src/foo.rs")));
p.cargo("package -v")
.with_status(101)
fn mk(&self) {
self.dirname().mkdir_p();
if self.src_is_dir {
- t!(os::window::fs::symlink_dir(&self.dst, &self.src));
+ t!(os::windows::fs::symlink_dir(&self.dst, &self.src));
} else {
t!(os::windows::fs::symlink_file(&self.dst, &self.src));
}
.push(FileBuilder::new(self.root.root().join(path), body));
}
- /// Adds a symlink to the project.
+ /// Adds a symlink to a file to the project.
pub fn symlink<T: AsRef<Path>>(mut self, dst: T, src: T) -> Self {
self.symlinks.push(SymlinkBuilder::new(
self.root.root().join(dst),
self
}
+ /// Create a symlink to a directory
pub fn symlink_dir<T: AsRef<Path>>(mut self, dst: T, src: T) -> Self {
self.symlinks.push(SymlinkBuilder::new_dir(
self.root.root().join(dst),