mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
* Make embedding resources optional * Move remaining cef rc to internal module * Move embedded resources to separate crate * Review fixup * Fix * Fix read * Add read error
17 lines
757 B
Rust
17 lines
757 B
Rust
const RESOURCES: &str = "../../frontend/dist";
|
|
|
|
// Check if the directory `RESOURCES` exists and sets the embedded_resources cfg accordingly
|
|
// Absolute path of `RESOURCES` available via the `EMBEDDED_RESOURCES` environment variable
|
|
fn main() {
|
|
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
|
|
println!("cargo:rerun-if-changed={RESOURCES}");
|
|
if let Ok(resources) = crate_dir.join(RESOURCES).canonicalize()
|
|
&& resources.exists()
|
|
{
|
|
println!("cargo:rustc-cfg=embedded_resources");
|
|
println!("cargo:rustc-env=EMBEDDED_RESOURCES={}", resources.to_string_lossy());
|
|
} else {
|
|
println!("cargo:warning=Resource directory does not exist. Resources will not be embedded. Did you forget to build the frontend?");
|
|
}
|
|
}
|