Skip to content

Commit

Permalink
fix path resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Voxelot committed Dec 24, 2021
1 parent cd61615 commit af4008e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions fuel-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,11 @@ use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=./assets/debugAdapterProtocol.json");

let package = env::var("CARGO_PKG_NAME").expect("failed to get package name");
let version = env::var("CARGO_PKG_VERSION").expect("failed to get package version");

let path = env::var("CARGO_MANIFEST_DIR")
.map(PathBuf::from)
.map(|p| {
p.parent()
.expect("Failed to uproot")
.join(format!("{}-{}", package, version))
.join("assets/debugAdapterProtocol.json")
})
.map(|p| p.join("assets/debugAdapterProtocol.json"))
.expect("Failed to fetch JSON schema");

dbg!(&path);

let json = fs::read_to_string(&path).expect("Failed to parse JSON from schema");
let schema: Schema = serde_json::from_str(&json).expect("Failed to parse Schema from JSON");
let root_name = schema.title.clone().unwrap_or_else(|| "Root".to_owned());
Expand Down

0 comments on commit af4008e

Please sign in to comment.