mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-11 15:42:43 +02:00
fix(cli): smarter windows path resolution
This commit improves Windows path resolution so that when people run the ahk-asc command with "applications.yaml" as an argument, without having ".\" prepended, the command will still succeed as expected. fix #192
This commit is contained in:
+11
-8
@@ -1293,15 +1293,18 @@ fn resolve_windows_path(raw_path: &str) -> Result<PathBuf> {
|
|||||||
.parent()
|
.parent()
|
||||||
.ok_or_else(|| anyhow!("cannot parse directory"))?;
|
.ok_or_else(|| anyhow!("cannot parse directory"))?;
|
||||||
|
|
||||||
let file = full_path
|
Ok(if parent.is_dir() {
|
||||||
.components()
|
let file = full_path
|
||||||
.last()
|
.components()
|
||||||
.ok_or_else(|| anyhow!("cannot parse filename"))?;
|
.last()
|
||||||
|
.ok_or_else(|| anyhow!("cannot parse filename"))?;
|
||||||
|
|
||||||
let mut canonicalized = std::fs::canonicalize(parent)?;
|
let mut canonicalized = std::fs::canonicalize(parent)?;
|
||||||
canonicalized.push(file);
|
canonicalized.push(file);
|
||||||
|
canonicalized
|
||||||
Ok(canonicalized)
|
} else {
|
||||||
|
full_path
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) {
|
fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) {
|
||||||
|
|||||||
Reference in New Issue
Block a user