mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-23 18:29:50 -04:00
FIX: Builds on windows now.
This commit is contained in:
parent
ebb06c169b
commit
b83c57b1f6
@ -17,17 +17,18 @@ fn generate_rust_module() -> String {
|
|||||||
let path = entry.into_path();
|
let path = entry.into_path();
|
||||||
// We only include files that are not test files.
|
// We only include files that are not test files.
|
||||||
let path_str = path.to_string_lossy().to_string();
|
let path_str = path.to_string_lossy().to_string();
|
||||||
|
let fixed_path_str = path_str.replace(std::path::MAIN_SEPARATOR, "/");
|
||||||
if path.is_file() && !path_str.ends_with("_test.ucg") {
|
if path.is_file() && !path_str.ends_with("_test.ucg") {
|
||||||
println!("Adding lib file: {}", path_str);
|
println!("Adding lib file: {}", path_str);
|
||||||
let out_path = PathBuf::from(format!("{}/{}", out_dir, path_str));
|
let out_path = PathBuf::from(format!("{}{}{}", out_dir, std::path::MAIN_SEPARATOR, path_str));
|
||||||
// We have to copy the file into out out directory to ensure that we
|
// We have to copy the file into out out directory to ensure that we
|
||||||
// have a reliable way for the stdlib.rs module file to include them
|
// have a reliable way for the stdlib.rs module file to include them
|
||||||
// from.
|
// from.
|
||||||
std::fs::create_dir_all(out_path.parent().unwrap()).unwrap();
|
std::fs::create_dir_all(out_path.parent().unwrap()).unwrap();
|
||||||
std::fs::copy(&path_str, &out_path).unwrap();
|
std::fs::copy(&path_str, &out_path).unwrap();
|
||||||
let include = format!(
|
let include = format!(
|
||||||
"\tstdlib.insert(\n\t\t\"{}\".to_string(),\n\t\tinclude_str!(\"{}/{}\"));\n",
|
"\tstdlib.insert(\n\t\tr\"{}\".to_string(),\n\t\tinclude_str!(r\"{}{}{}\"));\n",
|
||||||
path_str, out_dir, path_str
|
fixed_path_str, out_dir, std::path::MAIN_SEPARATOR, path_str
|
||||||
);
|
);
|
||||||
rust_lib.push_str(&include);
|
rust_lib.push_str(&include);
|
||||||
rust_lib.push_str("\n");
|
rust_lib.push_str("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user