Skip to content

Commit

Permalink
try to make create_symlink platform-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed May 28, 2024
1 parent 3147666 commit 58ac55a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ pub fn source_path() -> PathBuf {
}

/// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
#[cfg(target_os = "windows")]
pub fn create_symlink<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) {
if is_windows() {
use std::os::windows::fs;
fs::symlink_file(original, link).unwrap();
} else {
use std::os::unix::fs;
fs::symlink(original, link).unwrap();
}
use std::os::windows::fs;
fs::symlink_file(original, link).unwrap();
}

/// Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
#[cfg(target_os = "unix")]
pub fn create_symlink<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) {
use std::os::unix::fs;
fs::symlink(original, link).unwrap();
}

/// Construct the static library name based on the platform.
Expand Down

0 comments on commit 58ac55a

Please sign in to comment.