Fixed #22256 -- Replaced bad fallback for missing PATH

Thanks Baptiste Mispelon for the review.