Don't send non-existent extra-lib-dirs to GHC
Describe the bug
GHC On Windows is rather strict about extra-lib-dirs paths existing. The issue this is causing is that when installing cabal through chocolatey I would like to make it as friction less as possible. Installing msys2 is not a hard requirement and I can't guarantee the order in which cabal and msys2 are installed.
So I pre-populate the extra-lib-dirs with the expected paths to msys2. But then this makes it unusable if msys2 isn't installed at some point since GHC will bail out on the none existing path.
It would be great if we could filter out lib dirs that don't exist when calling GHC. I can't think of a way this can go wrong w.r.t dependencies.
Also see #6304
To Reproduce
cabal user-config update -a 'extra-lib-dirs: C:\foo'
cabal v2-repl
Expected behavior
I expect C:\foo not to be passed to ghci since it doesn't exist.
System information
- Windows 10
- cabal 3.0.0.0 GHC 8.8.1
Additional context I currently require the user to re-install the cabal package after they install msys2, but that's not very obvious and not very friction free.