v0.1.4-pre.008-fix.002

This commit is contained in:
2026-08-16 13:35:12 +02:00
parent 73d05862af
commit 60d3cb5606
15 changed files with 420 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-config-desk/src/main.rs
// version: 2
// version: 3
//! Binary entry point for the KSP configuration desktop application.
@@ -11,6 +11,11 @@
use fs2::FileExt; // rust-rules: trait-import
fn main() -> std::process::ExitCode {
let working_directory = configure_runtime_working_directory();
if let std::result::Result::Err(error) = working_directory {
eprintln!("cannot configure Config Desk runtime working directory: {error}");
return std::process::ExitCode::FAILURE;
}
let mut lock_path = std::env::temp_dir();
lock_path.push("com_sasedev_ksp_app_config_desk.lock");
let lock_file = match std::fs::OpenOptions::new().read(true).write(true).create(true).truncate(false).open(&lock_path) {
@@ -39,3 +44,15 @@ fn main() -> std::process::ExitCode {
},
};
}
fn configure_runtime_working_directory() -> std::io::Result<()> {
#[cfg(debug_assertions)]
{
let workspace_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
return std::env::set_current_dir(workspace_root);
}
#[cfg(not(debug_assertions))]
{
return std::result::Result::Ok(());
}
}