Skip to content

Commit 58ac55a

Browse files
committed
try to make create_symlink platform-specific
1 parent 3147666 commit 58ac55a

File tree

1 file changed

+10
-7
lines changed
  • src/tools/run-make-support/src

1 file changed

+10
-7
lines changed

src/tools/run-make-support/src/lib.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,17 @@ pub fn source_path() -> PathBuf {
7777
}
7878

7979
/// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
80+
#[cfg(target_os = "windows")]
8081
pub fn create_symlink<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) {
81-
if is_windows() {
82-
use std::os::windows::fs;
83-
fs::symlink_file(original, link).unwrap();
84-
} else {
85-
use std::os::unix::fs;
86-
fs::symlink(original, link).unwrap();
87-
}
82+
use std::os::windows::fs;
83+
fs::symlink_file(original, link).unwrap();
84+
}
85+
86+
/// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
87+
#[cfg(target_os = "unix")]
88+
pub fn create_symlink<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) {
89+
use std::os::unix::fs;
90+
fs::symlink(original, link).unwrap();
8891
}
8992

9093
/// Construct the static library name based on the platform.

0 commit comments

Comments
 (0)