fix: spawn.log ghi vao %APPDATA%/SonicForgeDAW/logs (thu muc luon ton tai) — engine_dir co the khong duoc bundle vao installer
This commit is contained in:
+17
-6
@@ -25,17 +25,28 @@ pub fn run() {
|
||||
} else {
|
||||
engine_dir.join("daw_engine")
|
||||
};
|
||||
// Ghi log spawn de chan doan (UI khong duoc panic/thoat — chi log)
|
||||
// Ghi log spawn de chan doan (UI khong duoc panic/thoat — chi log).
|
||||
// Ghi vao %APPDATA%/SonicForgeDAW/logs/spawn.log (thu muc luon ton
|
||||
// tai) — KHONG ghi vao engine_dir vi thu muc do co the khong duoc
|
||||
// bundle vao installer (resources loi) -> ghi am tham that bai.
|
||||
let log_dir = std::env::var("APPDATA").unwrap_or_else(|_| ".".into());
|
||||
let spawn_log_path = std::path::Path::new(&log_dir)
|
||||
.join("SonicForgeDAW")
|
||||
.join("logs")
|
||||
.join("spawn.log");
|
||||
if let Some(parent) = spawn_log_path.parent() {
|
||||
let _ = std::fs::create_dir_all(parent);
|
||||
}
|
||||
let log_line = format!(
|
||||
"spawn daw_engine: {} exists={}\n",
|
||||
"spawn daw_engine: {} exists={}\nresource_dir={}\n",
|
||||
engine_exe.display(),
|
||||
engine_exe.exists()
|
||||
engine_exe.exists(),
|
||||
res_dir.display()
|
||||
);
|
||||
if let Some(mut f) = std::fs::OpenOptions::new()
|
||||
if let Ok(mut f) = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open(engine_dir.join("spawn.log"))
|
||||
.ok()
|
||||
.open(&spawn_log_path)
|
||||
{
|
||||
use std::io::Write;
|
||||
let _ = f.write_all(log_line.as_bytes());
|
||||
|
||||
Reference in New Issue
Block a user