build.rs 742 B

123456789101112131415161718192021222324
  1. #[cfg(not(feature = "dev-server"))]
  2. extern crate tauri_includedir_codegen;
  3. pub fn main() {
  4. #[cfg(not(feature = "dev-server"))]
  5. {
  6. match std::env::var("TAURI_DIST_DIR") {
  7. Ok(dist_path) => {
  8. let inlined_assets = match std::env::var("TAURI_INLINED_ASSETS") {
  9. Ok(assets) => {
  10. assets.split("|").map(|s| s.to_string()).collect()
  11. }
  12. Err(_) => Vec::new()
  13. };
  14. // include assets
  15. tauri_includedir_codegen::start("ASSETS")
  16. .dir(dist_path, tauri_includedir_codegen::Compression::None)
  17. .build("data.rs", inlined_assets)
  18. .expect("failed to build data.rs")
  19. }
  20. Err(e) => panic!("Build error: Couldn't find ENV: {}", e),
  21. }
  22. }
  23. }