debug: add file-based startup log to diagnose silent crash
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 2m47s
All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 2m47s
Writes to %APPDATA%\Wraith\wraith-startup.log since release builds suppress all console output via windows_subsystem. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
db1bd39030
commit
8602f1779b
@ -104,9 +104,30 @@ pub fn data_directory() -> PathBuf {
|
|||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
|
// Debug log to file — release builds hide console output via windows_subsystem = "windows"
|
||||||
|
let log_path = data_directory().join("wraith-startup.log");
|
||||||
|
let _ = std::fs::create_dir_all(data_directory());
|
||||||
|
let log = |msg: &str| {
|
||||||
|
use std::io::Write;
|
||||||
|
if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(&log_path) {
|
||||||
|
let _ = writeln!(f, "{}", msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
log("=== Wraith starting ===");
|
||||||
let data_dir = data_directory();
|
let data_dir = data_directory();
|
||||||
let app_state = AppState::new(data_dir)
|
log(&format!("Data dir: {:?}", data_dir));
|
||||||
.expect("Failed to initialize application state");
|
|
||||||
|
let app_state = match AppState::new(data_dir) {
|
||||||
|
Ok(state) => {
|
||||||
|
log("AppState initialized OK");
|
||||||
|
state
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log(&format!("FATAL: AppState init failed: {}", e));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Seed built-in themes (INSERT OR IGNORE — safe to call on every boot).
|
// Seed built-in themes (INSERT OR IGNORE — safe to call on every boot).
|
||||||
app_state.theme.seed_builtins();
|
app_state.theme.seed_builtins();
|
||||||
@ -125,6 +146,8 @@ pub fn run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log("Building Tauri app...");
|
||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||||
@ -172,5 +195,7 @@ pub fn run() {
|
|||||||
commands::theme_commands::get_theme,
|
commands::theme_commands::get_theme,
|
||||||
])
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.unwrap_or_else(|e| {
|
||||||
|
log(&format!("FATAL: Tauri run failed: {}", e));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user