diff --git a/TODO.md b/TODO.md index 01d2872..4e6a59b 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ Desirable things These changes may or may not be implemented in the future. * bug: proper fix for https://github.com/tauri-apps/tauri/issues/9127 (currently worked-around via fork; fix may be in beta12, or it might not work) * bug: open menu command sometimes opens multiple dialogues -* bug: no CLI output on windows * edge case: mutations can fail due to ambiguity due to other writers; this should update the UI. maybe use a special From on resolve_change * perf: optimise revdetail loads - we already have the header * perf: better solution to slow immutability check - jj-lib will have a revset contains cache soon diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 23d36ae..c34ece3 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2013,6 +2013,7 @@ dependencies = [ "tempfile", "thiserror", "ts-rs", + "windows 0.54.0", "zip", ] @@ -2933,7 +2934,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -6698,7 +6699,7 @@ dependencies = [ "webview2-com-macros", "webview2-com-sys", "windows 0.52.0", - "windows-core", + "windows-core 0.52.0", "windows-implement", "windows-interface", ] @@ -6722,7 +6723,7 @@ checksum = "d6ad85fceee6c42fa3d61239eba5a11401bf38407a849ed5ea1b407df08cca72" dependencies = [ "thiserror", "windows 0.52.0", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -6795,12 +6796,22 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-core", + "windows-core 0.52.0", "windows-implement", "windows-interface", "windows-targets 0.52.4", ] +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-targets 0.52.4", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -6810,6 +6821,16 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets 0.52.4", +] + [[package]] name = "windows-implement" version = "0.52.0" @@ -6832,6 +6853,15 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "windows-result" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.45.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2bad7c8..df70b9b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -47,3 +47,6 @@ clap = { version = "4.5.3", features = ["derive"] } [patch.crates-io] muda = { git = "https://github.com/gulbanana/muda.git", branch = "tauri-9127" } + +[target."cfg(windows)".dependencies] +windows = { version = "0.54.0", features = ["Win32_System_Console", "Win32_Foundation"] } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c71417b..03e1ae6 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -87,6 +87,13 @@ impl AppState { } fn main() -> Result<()> { + // before parsing args, attach a console on windows - will fail if not started from a shell, but that's fine + #[cfg(windows)] + { + use windows::Win32::System::Console::{AttachConsole, ATTACH_PARENT_PROCESS}; + let _ = unsafe { AttachConsole(ATTACH_PARENT_PROCESS) }; + } + let args = Args::parse(); tauri::Builder::default() diff --git a/src-tauri/src/worker/mod.rs b/src-tauri/src/worker/mod.rs index 28a2360..5c358c4 100644 --- a/src-tauri/src/worker/mod.rs +++ b/src-tauri/src/worker/mod.rs @@ -11,6 +11,7 @@ mod tests; use std::{ env::{self, VarError}, fmt::Debug, + fs, path::PathBuf, }; @@ -79,7 +80,7 @@ impl WorkerSession { pub fn get_cwd(&self) -> Result { self.working_directory .as_ref() - .map(|cwd| Ok(cwd.clone())) + .map(|cwd| Ok(fs::canonicalize(cwd.clone())?)) .or_else(|| match env::var("OWD") { Ok(var) => Some(Ok(PathBuf::from(var))), Err(VarError::NotPresent) => None,