bergercookie / asm-lsp

Language server for NASM/GAS/GO Assembly
https://crates.io/crates/asm-lsp
BSD 2-Clause "Simplified" License
269 stars 18 forks source link

fix(config builder): compiler validation on windows #176

Closed WillLillis closed 5 days ago

WillLillis commented 5 days ago

The basic problem here is that windows allows you to omit a file extension when referring to a file. That is, gcc is perfectly fine to refer to gcc.exe. However, calling .is_file() on a path ending with gcc where the file is actually gcc.exe will return false. This causes a bug in our compiler validation logic on Windows, leading us to tell users that their compiler couldn't be found when it definitely was.

The fix is to simply iterate over common executable extension when the is_file() check fails. If any of these extension paths exist and point to a file, we'll consider that good enough™️ and treat it as a valid compiler path. We'll still print a warning to the screen in this case, to avoid potential confusion.

Addresses the main issue raised in #173