forked from ardaku/alloy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
36 lines (29 loc) · 890 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
28
29
30
31
32
33
34
35
36
#[cfg(windows)]
extern crate winres;
use std::{env, fs, path::Path};
#[cfg(windows)]
fn platform_specific() {
let mut res = winres::WindowsResource::new();
res.set("FileDescription", "Alloy");
res.set_icon("resource_dev/alloy.ico");
res.compile().unwrap();
}
#[cfg(unix)]
fn platform_specific() {}
fn main() {
platform_specific();
let dir_name = "resource";
let profile = env::var("PROFILE").unwrap();
let target_resource_path = Path::new("target").join(profile).join(dir_name);
fs::create_dir_all(target_resource_path.clone()).unwrap();
for entry in fs::read_dir("resource/").unwrap() {
let entry = entry.unwrap();
if entry.file_type().unwrap().is_file() {
fs::copy(
entry.path(),
target_resource_path.join(entry.file_name()),
)
.unwrap();
}
}
}