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
37
38
39
40
41
42
43
44
#![allow(warnings)]
use std::{
env,
error::Error,
fs::{self, File},
io::Write,
path::Path,
};
extern crate winres;
const SOURCE_DIR: &str = r"project";
fn main() -> Result<(), Box<dyn Error>> {
if cfg!(target_os = "windows") {
let mut res = winres::WindowsResource::new();
res.set_icon("mech.ico");
res.compile().unwrap();
}
/*
let out_dir = env::var("OUT_DIR")?;
let dest_path = Path::new(&out_dir).join("mech_app_files.rs");
let mut all_the_files = File::create(&dest_path)?;
writeln!(&mut all_the_files, r##"["##,)?;
for f in fs::read_dir(SOURCE_DIR)? {
let f = f?;
if !f.file_type()?.is_file() {
continue;
}
writeln!(
&mut all_the_files,
r##"(r"{name}", include_bytes!(r"../../../../../{name}")),"##,
name = f.path().display(),
)?;
}
writeln!(&mut all_the_files, r##"]"##,)?;*/
Ok(())
}