From 83d6a6fbe78d63b6ce8d3a1acd5b23becde98fa1 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sun, 11 Oct 2026 23:27:01 +0200 Subject: [PATCH] =?UTF-8?q?App:=20files=20on=20the=20command=20line=20open?= =?UTF-8?q?=20like=20File=20=E2=80=BA=20Open=20(#11)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A password-protected file named on the command line (a Windows or Linux double-click) now asks for its password, and open errors are shown instead of only logged. Co-Authored-By: Claude Opus 5.5 --- apps/gridcraft/src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/gridcraft/src/main.rs b/apps/gridcraft/src/main.rs index 25624cf..2f67466 100644 --- a/apps/gridcraft/src/main.rs +++ b/apps/gridcraft/src/main.rs @@ -304,19 +304,20 @@ fn main() -> eframe::Result<()> { { log::warn!("sample {s}: {e}"); } - for f in &files { - if let Err(e) = session.execute("file.open", json!({"path": f})) { - log::warn!("{f}: {e}"); - } - } if session.documents().is_empty() { session.new_workbook(); } let mut app = SheetApp::new(session, services()); app.watch_desktop_theme(); - app.after_engine(); // Show warnings from files opened on the command line. + app.after_engine(); // Show warnings from the sample. let control_port = control_port; load_prefs(&mut app); + // Files named on the command line (a double-click on Windows and Linux) open as File › Open + // opens them: a password-protected one asks for its password, and errors are shown, not + // only logged. Each replaces the untouched blank Book1, as a file opened from Finder does. + for f in &files { + app.open_path(f); + } let mut viewport = egui::ViewportBuilder::default() .with_title("GridCraft") .with_inner_size([1440.0, 900.0])