2023-01-31 17:55:57 +03:00
|
|
|
fn main() {
|
2024-03-01 15:00:31 +03:00
|
|
|
// Make the UI build directory if it doesn't already exist.
|
|
|
|
// We do this here because the tauri context macro expects it to
|
|
|
|
// exist at build time, and it's otherwise manually required to create
|
|
|
|
// it before building.
|
|
|
|
let manifest_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
2024-04-04 12:56:56 +03:00
|
|
|
assert_eq!(manifest_dir.file_name().unwrap(), "gitbutler-tauri");
|
|
|
|
let build_dir = manifest_dir
|
|
|
|
.parent()
|
|
|
|
.unwrap()
|
|
|
|
.parent()
|
|
|
|
.unwrap()
|
|
|
|
.join("app")
|
|
|
|
.join("build");
|
2024-03-01 15:00:31 +03:00
|
|
|
if !build_dir.exists() {
|
|
|
|
// NOTE(qix-): Do not use `create_dir_all` here - the parent directory
|
|
|
|
// NOTE(qix-): already exists, and we want to fail if not (for some reason).
|
|
|
|
#[allow(clippy::expect_fun_call, clippy::create_dir)]
|
2024-04-04 12:56:56 +03:00
|
|
|
std::fs::create_dir(&build_dir)
|
|
|
|
.expect(format!("failed to create app/build directory: {:?}", build_dir).as_str());
|
2024-03-01 15:00:31 +03:00
|
|
|
}
|
|
|
|
|
2023-10-18 17:39:14 +03:00
|
|
|
tauri_build::build();
|
2023-01-31 17:55:57 +03:00
|
|
|
}
|