Fix file watching when only file name is given ()

Fixes 
This commit is contained in:
Alexander Korn 2023-03-29 22:57:12 +02:00 committed by GitHub
parent 72fb155403
commit f04b6ebc1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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()