#![doc = include_str!("../README.md")]
use std::{collections::HashMap, path::PathBuf};
pub fn configure_platform() {
println!("cargo:rustc-check-cfg=cfg(platform_windows)");
println!("cargo:rustc-check-cfg=cfg(platform_linux)");
println!("cargo:rustc-check-cfg=cfg(platform_macos)");
println!("cargo:rustc-check-cfg=cfg(platform_android)");
println!("cargo:rustc-check-cfg=cfg(platform_ios)");
}
#[must_use]
pub fn workspace_dir() -> PathBuf {
let metadata = cargo_metadata::MetadataCommand::new()
.exec()
.expect("failed to run cargo metadata");
metadata.workspace_root.into_std_path_buf()
}
pub fn setup_paths() {
println!(
"cargo:rustc-env=WORKSPACE_ROOT={}",
workspace_dir().display()
);
let workspace_root = PathBuf::from(".");
let mut paths = HashMap::new();
paths.insert("SAVED_PATH", "saved");
paths.insert("ASSETS_PATH", "assets");
for (name, path) in paths {
println!(
"cargo:rustc-env={name}={}",
workspace_root.join(path).display()
);
}
}