lstat() is sometimes invoked with a path that ends in a slash (in particular, when dealing with subprojects). Windows's stat() does not accept such paths and fails with ENOENT. In this case we try again with a cleaned-up path.