fix steam integration
This commit is contained in:
@@ -1,3 +1,42 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
use std::{env, fs::{self, read_dir}, path::{Path, PathBuf}};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tauri_build::build();
|
||||
|
||||
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
|
||||
|
||||
let profile_target_dir = out_dir
|
||||
.ancestors()
|
||||
.nth(3)
|
||||
.ok_or("Failed to determine profile target directory from OUT_DIR")?;
|
||||
|
||||
println!(
|
||||
"cargo:info=Build script running for target OS: {}",
|
||||
env::var("CARGO_CFG_TARGET_OS").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"cargo:info=Final libraries will be copied to: {}",
|
||||
profile_target_dir.display()
|
||||
);
|
||||
|
||||
// --- Define libraries and their source locations based on OS ---
|
||||
let target_os = env::var("CARGO_CFG_TARGET_OS")?;
|
||||
|
||||
let source_subdir = if target_os == "windows" {
|
||||
"lib/win64"
|
||||
} else if target_os == "linux" {
|
||||
"lib/linux64"
|
||||
} else if target_os == "macos" {
|
||||
"lib/osx"
|
||||
} else {
|
||||
return Err("Unsupported target".into());
|
||||
};
|
||||
|
||||
for f in read_dir(source_subdir)? {
|
||||
let f = f?;
|
||||
println!("cargo:rerun-if-changed={}", f.path().display());
|
||||
fs::copy(f.path(), profile_target_dir.join(f.file_name()))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user