Skip to content

Commit f22da42

Browse files
committed
fix windows console and relative paths
1 parent 418dafa commit f22da42

File tree

5 files changed

+46
-6
lines changed

5 files changed

+46
-6
lines changed

TODO.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Desirable things
44
These changes may or may not be implemented in the future.
55
* 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)
66
* bug: open menu command sometimes opens multiple dialogues
7-
* bug: no CLI output on windows
87
* 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
98
* perf: optimise revdetail loads - we already have the header
109
* perf: better solution to slow immutability check - jj-lib will have a revset contains cache soon

src-tauri/Cargo.lock

Lines changed: 34 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ clap = { version = "4.5.3", features = ["derive"] }
4747

4848
[patch.crates-io]
4949
muda = { git = "https://github.com/gulbanana/muda.git", branch = "tauri-9127" }
50+
51+
[target."cfg(windows)".dependencies]
52+
windows = { version = "0.54.0", features = ["Win32_System_Console", "Win32_Foundation"] }

src-tauri/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ impl AppState {
8787
}
8888

8989
fn main() -> Result<()> {
90+
// before parsing args, attach a console on windows - will fail if not started from a shell, but that's fine
91+
#[cfg(windows)]
92+
{
93+
use windows::Win32::System::Console::{AttachConsole, ATTACH_PARENT_PROCESS};
94+
let _ = unsafe { AttachConsole(ATTACH_PARENT_PROCESS) };
95+
}
96+
9097
let args = Args::parse();
9198

9299
tauri::Builder::default()

src-tauri/src/worker/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod tests;
1111
use std::{
1212
env::{self, VarError},
1313
fmt::Debug,
14+
fs,
1415
path::PathBuf,
1516
};
1617

@@ -79,7 +80,7 @@ impl WorkerSession {
7980
pub fn get_cwd(&self) -> Result<PathBuf> {
8081
self.working_directory
8182
.as_ref()
82-
.map(|cwd| Ok(cwd.clone()))
83+
.map(|cwd| Ok(fs::canonicalize(cwd.clone())?))
8384
.or_else(|| match env::var("OWD") {
8485
Ok(var) => Some(Ok(PathBuf::from(var))),
8586
Err(VarError::NotPresent) => None,

0 commit comments

Comments
 (0)