mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-23 01:49:21 +01: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:
@@ -1293,15 +1293,18 @@ fn resolve_windows_path(raw_path: &str) -> Result<PathBuf> {
|
||||
.parent()
|
||||
.ok_or_else(|| anyhow!("cannot parse directory"))?;
|
||||
|
||||
let file = full_path
|
||||
.components()
|
||||
.last()
|
||||
.ok_or_else(|| anyhow!("cannot parse filename"))?;
|
||||
Ok(if parent.is_dir() {
|
||||
let file = full_path
|
||||
.components()
|
||||
.last()
|
||||
.ok_or_else(|| anyhow!("cannot parse filename"))?;
|
||||
|
||||
let mut canonicalized = std::fs::canonicalize(parent)?;
|
||||
canonicalized.push(file);
|
||||
|
||||
Ok(canonicalized)
|
||||
let mut canonicalized = std::fs::canonicalize(parent)?;
|
||||
canonicalized.push(file);
|
||||
canonicalized
|
||||
} else {
|
||||
full_path
|
||||
})
|
||||
}
|
||||
|
||||
fn show_window(hwnd: HWND, command: SHOW_WINDOW_CMD) {
|
||||
|
||||
Reference in New Issue
Block a user