Skip to content

Commit

Permalink
added script to get sim_const
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-cavalcanti committed Oct 12, 2023
1 parent bb1c915 commit 647d530
Show file tree
Hide file tree
Showing 20 changed files with 5,847 additions and 1,248 deletions.
32 changes: 32 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std::env;
use std::fs;
use std::path::Path;

fn main() {
let project_dir = env::var_os("CARGO_MANIFEST_DIR").unwrap();

let sim_const_file_name = "sim_const.rs";
let sim_api_file_name = "sim_api.rs";
let sim_ik_api_file_name = "sim_ik_api.rs";

let sim_dir = Path::new(&project_dir)
.join("src")
.join("remote_api_objects")
.join("sim");

let assets = Path::new(&project_dir).join("c_transpiler").join("assets");

let files = [sim_ik_api_file_name, sim_const_file_name, sim_api_file_name];

for file in files {
let origin = assets.join(file);
let dest = sim_dir.join(file);

let content =
fs::read_to_string(origin.clone()).unwrap_or_else(|_| panic!("read: {origin:?}"));

fs::write(dest.clone(), content).unwrap_or_else(|_| panic!("write: {dest:?}"));
}

println!("cargo:rerun-if-changed=build.rs");
}
Loading

0 comments on commit 647d530

Please sign in to comment.