From f04b6ebc1a17e22596c16158042030f910b85559 Mon Sep 17 00:00:00 2001 From: Alexander Korn Date: Wed, 29 Mar 2023 22:57:12 +0200 Subject: [PATCH] Fix file watching when only file name is given (#433) Fixes #300 --- cli/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 64108a06..d48917a2 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -189,7 +189,13 @@ fn dispatch(command: Command) -> StrResult<()> { fn compile(command: CompileCommand) -> StrResult<()> { let root = if let Some(root) = &command.root { root.clone() - } else if let Some(dir) = command.input.parent() { + } else if let Some(dir) = command + .input + .canonicalize() + .ok() + .as_ref() + .and_then(|path| path.parent()) + { dir.into() } else { PathBuf::new()