-
Notifications
You must be signed in to change notification settings - Fork 39
/
build.rs
34 lines (27 loc) · 792 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
#[cfg(windows)]
extern crate winres;
use std::env;
use std::fs;
use std::path::Path;
#[cfg(windows)]
fn platform_specific() {
let mut res = winres::WindowsResource::new();
res.set("FileDescription", "Emulsion");
res.set_icon("resource_dev/emulsion.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();
}
}
}