fix nebula-ffi buildscript
/ build (push) Successful in 1m36s Details
/ build_x64 (push) Failing after 2m15s Details
/ build_arm64 (push) Failing after 5m58s Details
/ build_win64 (push) Failing after 3m51s Details

This commit is contained in:
core 2023-12-15 22:59:20 -05:00
parent 1a2ad44d58
commit 7fcb20a823
Signed by: core
GPG Key ID: FDBF740DADDCEECF
1 changed files with 8 additions and 11 deletions

View File

@ -4,19 +4,16 @@ use std::path::PathBuf;
use std::{env, process}; use std::{env, process};
fn get_cargo_target_dir() -> Result<std::path::PathBuf, Box<dyn std::error::Error>> { fn get_cargo_target_dir() -> Result<std::path::PathBuf, Box<dyn std::error::Error>> {
let skip_triple = std::env::var("TARGET")? == std::env::var("HOST")?;
let skip_parent_dirs = if skip_triple { 4 } else { 5 };
let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR")?); let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR")?);
let profile = std::env::var("PROFILE")?; let mut current = out_dir.as_path();
let mut target_dir = None; for _ in 0..skip_parent_dirs {
let mut sub_path = out_dir.as_path(); current = current.parent().ok_or("not found")?;
while let Some(parent) = sub_path.parent() {
if parent.ends_with(&profile) {
target_dir = Some(parent);
break;
} }
sub_path = parent;
} Ok(std::path::PathBuf::from(current))
let target_dir = target_dir.ok_or("not found")?;
Ok(target_dir.to_path_buf())
} }
fn main() { fn main() {