Desktop: Bundle for Mac and Windows (#3297)

* add bundle for mac os and windows

* Fix bundle name

This name gets used as the display name of the app on mac os, shorter name looks better and is more consistent.

* preserve std out by running bin directly

* bundle placeholder on linux

* fix linux
This commit is contained in:
Timon
2025-10-23 10:39:08 +00:00
committed by GitHub
parent 557df6917d
commit 7fbe440e73
21 changed files with 429 additions and 15 deletions
+35
View File
@@ -0,0 +1,35 @@
use std::error::Error;
use std::fs;
use std::path::{Path, PathBuf};
use crate::common::*;
const PACKAGE: &str = "graphite-desktop-platform-win";
const EXECUTABLE: &str = "graphite-editor.exe";
pub fn main() -> Result<(), Box<dyn Error>> {
let app_bin = build_bin(PACKAGE, None)?;
let executable = bundle(&profile_path(), &app_bin);
// TODO: Consider adding more useful cli
if std::env::args().any(|a| a == "open") {
let executable_path = executable.to_string_lossy();
run_command(&executable_path, &[]).expect("failed to open app")
}
Ok(())
}
fn bundle(out_dir: &Path, app_bin: &Path) -> PathBuf {
let app_dir = out_dir.join(APP_NAME);
clean_dir(&app_dir);
copy_dir(&cef_path(), &app_dir);
let bin_path = app_dir.join(EXECUTABLE);
fs::copy(app_bin, &bin_path).unwrap();
bin_path
}