From c3802bb69c1d9f8713f7e6553abac4f3734a4bbb Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Thu, 4 Jun 2015 00:03:25 -0400 Subject: [PATCH] Add helper method for creating symlinks. --- test/common/util.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/common/util.rs b/test/common/util.rs index 2d940e6c3..75a609b5c 100644 --- a/test/common/util.rs +++ b/test/common/util.rs @@ -2,6 +2,10 @@ use std::fs::{self, File}; use std::io::{Read, Write}; +#[cfg(unix)] +use std::os::unix::fs::symlink as symlink_file; +#[cfg(windows)] +use std::os::windows::fs::symlink_file; use std::path::Path; use std::process::{Command, Stdio}; use std::str::from_utf8; @@ -74,6 +78,10 @@ pub fn touch(file: &str) { File::create(Path::new(file)).unwrap(); } +pub fn symlink(src: &str, dst: &str) { + symlink_file(src, dst).unwrap(); +} + pub fn cleanup(path: &'static str) { let p = Path::new(path); match fs::metadata(p) {