forked from ales-tsurko/athenaCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
27 lines (25 loc) · 768 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#![allow(missing_docs)]
use std::path::PathBuf;
fn main() {
if cfg!(debug_assertions) {
symlink("resources", "target/debug/resources");
} else {
symlink("resources", "target/release/resources");
}
// recompile in case the puthon code has changed
println!("cargo:rerun-if-changed=pysrc");
println!("cargo:rerun-if-changed=tests/*.py");
}
fn symlink(original: &str, link: &str) {
let path = PathBuf::from(link);
if !path.is_symlink() && !path.exists() {
#[cfg(target_family = "unix")]
{
std::os::unix::fs::symlink(original, link).unwrap();
}
#[cfg(target_family = "windows")]
{
std::os::windows::fs::symlink_dir(original, link).unwrap();
}
}
}