Skip to content

'withFilePath' not in scope, windows build, using base 4.1.0.0

The cabal file indicates that directory>=1.0.1.0 should install correctly with base>=4.1. However, running in windows, the System.Directory module expects to use the function withFilePath in its functions, but I have not seen it defined until base 4.2:

copyPermissions :: FilePath -> FilePath -> IO ()
copyPermissions source dest = do
#ifdef mingw32_HOST_OS
  allocaBytes sizeof_stat $ \ p_stat -> do
  withFilePath source $ \p_source -> do
  withFilePath dest $ \p_dest -> do
    throwErrnoIfMinus1_ "copyPermissions" $ c_stat p_source p_stat
    mode <- st_mode p_stat
    throwErrnoIfMinus1_ "copyPermissions" $ c_wchmod p_dest mode
#else
  stat <- Posix.getFileStatus source
  let mode = Posix.fileMode stat
  Posix.setFileMode dest mode
#endif

The compilation fails with:

[1 of 1] Compiling System.Directory ( System\Directory.hs, dist\build\System\Directory.o )

System\Directory.hs:179:2: Not in scope: `withFilePath'
System\Directory.hs:233:2: Not in scope: `withFilePath'
System\Directory.hs:267:2: Not in scope: `withFilePath'
System\Directory.hs:268:2: Not in scope: `withFilePath'
System\Directory.hs:951:6: Not in scope: `withFilePath'
System\Directory.hs:959:6: Not in scope: `withFilePath'
cabal.exe: Error: some packages failed to install:

I have attached the cabal build output to this ticket.

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/directory
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information