@@ -345,8 +345,8 @@ preprocessFile mbWorkDir searchLoc buildLoc forSDist baseFile verbosity builtinS
345
345
createDirectoryIfMissingVerbose verbosity True destDir
346
346
runPreProcessorWithHsBootHack
347
347
pp
348
- (getSymbolicPath $ psrcLoc, getSymbolicPath $ psrcRelFile)
349
- (getSymbolicPath $ buildLoc, srcStem <.> " hs" )
348
+ (psrcLoc, getSymbolicPath $ psrcRelFile)
349
+ (buildLoc, srcStem <.> " hs" )
350
350
where
351
351
i = interpretSymbolicPath mbWorkDir -- See Note [Symbolic paths] in Distribution.Utils.Path
352
352
buildAsSrcLoc :: SymbolicPath Pkg (Dir Source )
@@ -361,20 +361,25 @@ preprocessFile mbWorkDir searchLoc buildLoc forSDist baseFile verbosity builtinS
361
361
pp
362
362
(inBaseDir, inRelativeFile)
363
363
(outBaseDir, outRelativeFile) = do
364
+ -- Preprocessors are expected to take into account the working
365
+ -- directory, e.g. using runProgramCwd with a working directory
366
+ -- computed with mbWorkDirLBI.
367
+ -- Hence the use of 'getSymbolicPath' here.
364
368
runPreProcessor
365
369
pp
366
- (inBaseDir, inRelativeFile)
367
- (outBaseDir, outRelativeFile)
370
+ (getSymbolicPath $ inBaseDir, inRelativeFile)
371
+ (getSymbolicPath $ outBaseDir, outRelativeFile)
368
372
verbosity
369
373
370
- exists <- doesFileExist inBoot
371
- when exists $ copyFileVerbose verbosity inBoot outBoot
372
- where
374
+ -- Here we interact directly with the file system, so we must
375
+ -- interpret symbolic paths with respect to the working directory.
376
+ let
377
+ inFile = normalise (i inBaseDir </> inRelativeFile)
378
+ outFile = normalise (i outBaseDir </> outRelativeFile)
373
379
inBoot = replaceExtension inFile " hs-boot"
374
380
outBoot = replaceExtension outFile " hs-boot"
375
-
376
- inFile = normalise (inBaseDir </> inRelativeFile)
377
- outFile = normalise (outBaseDir </> outRelativeFile)
381
+ exists <- doesFileExist inBoot
382
+ when exists $ copyFileVerbose verbosity inBoot outBoot
378
383
379
384
-- ------------------------------------------------------------
380
385
0 commit comments