bugfix for when pathext ends in ';' (#2723)

This commit is contained in:
Darren Schroeder 2020-11-02 13:00:47 -06:00 committed by GitHub
parent 0f7e1d4d01
commit 50dd56d3c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,6 +65,8 @@ fn pathext() -> Option<Vec<String>> {
std::env::var_os("PATHEXT").map(|v| {
v.to_string_lossy()
.split(';')
// Filter out empty tokens and ';' at the end
.filter(|f| f.len() > 1)
// Cut off the leading '.' character
.map(|ext| ext[1..].to_string())
.collect::<Vec<_>>()