Skip to content

Commit

Permalink
fix(config builder): allow missing extensions for compiler executable…
Browse files Browse the repository at this point in the history
…s on windows
  • Loading branch information
WillLillis committed Nov 20, 2024
1 parent 9f28d49 commit 6245bb5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions asm-lsp/config_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,24 @@ fn is_executable(path: &Path) -> bool {
false
}
} else {
#[cfg(windows)]
{
// On Windows, it's valid to omit file extensions, i.e. `gcc` can be
// used to designate `gcc.exe`. However, this will cause `.is_file()`
// to return `false`, so we need to check for this case here rather
// than above
let extensions = ["exe", "cmd", "bat", "com"];
for ext in &extensions {
let Some(path) = path.to_str() else {
continue;
};
let ext_path = PathBuf::from(format!("{path}.{ext}"));
if ext_path.exists() && ext_path.is_file() {
println!("Warning: Extended provided path with \".{ext}\" in order to find valid compiler");
return true;
}
}
}
false
}
}
Expand Down

0 comments on commit 6245bb5

Please sign in to comment.