diff --git a/.gitignore b/.gitignore index 6985cf1..9a1668f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb + +!Resources/* diff --git a/Resources/harmony_link_core.dll b/Resources/harmony_link_core.dll new file mode 100644 index 0000000..405578c Binary files /dev/null and b/Resources/harmony_link_core.dll differ diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..b18a54e --- /dev/null +++ b/build.rs @@ -0,0 +1,32 @@ +use std::env; +use std::fs; +use std::path::Path; + +fn main() { + // The directory of the Cargo manifest of the package that is currently being built. + let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR is not defined"); + + // The directory where the final binaries will be placed. + let profile = env::var("PROFILE").expect("PROFILE is not defined"); + let out_dir = Path::new(&manifest_dir).join("target").join(profile); + + // The Resources directory. + let resources_dir = Path::new(&manifest_dir).join("Resources"); + + // Ensure the Resources directory exists. + if !resources_dir.exists() { + panic!("Resources directory does not exist"); + } + + // Iterate over each entry in the Resources directory. + for entry in fs::read_dir(resources_dir).expect("read_dir call failed") { + let entry = entry.expect("entry is invalid"); + let path = entry.path(); + if path.is_file() { + // The destination path is the output directory plus the file name. + let dest_path = out_dir.join(path.file_name().expect("file has no name")); + // Copy the file. + fs::copy(&path, &dest_path).expect("copy failed"); + } + } +}