summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorAlexander Korn <lxndio@users.noreply.github.com>2023-03-29 22:57:12 +0200
committerGitHub <noreply@github.com>2023-03-29 22:57:12 +0200
commitf04b6ebc1a17e22596c16158042030f910b85559 (patch)
tree710b44f9cbc4ee588917f4258f9b408a0314dbf6 /cli
parent72fb155403801216e244ab1df784ccd2a29c54cb (diff)
Fix file watching when only file name is given (#433)
Fixes #300
Diffstat (limited to 'cli')
-rw-r--r--cli/src/main.rs8
1 files changed, 7 insertions, 1 deletions
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()