Commit 2511ab4c authored by Pranit Bauva's avatar Pranit Bauva
Browse files

new-configure: output old config before rewriting `cabal.project.local`

The new-configure blows away the old `cabal.project.local`, even if
you've tweaked it by hand and it has some sort of substantial changes.
To prevents accidents like this from happening, we should store the old
local file as backup (`cabal.project.local~`) if we overwrite it.
Signed-off-by: Pranit Bauva's avatarPranit Bauva <>
parent c36aff19
......@@ -5,6 +5,9 @@ module Distribution.Client.CmdConfigure (
) where
import System.Directory
import Control.Monad
import Distribution.Client.ProjectOrchestration
import Distribution.Client.ProjectConfig
( writeProjectLocalExtraConfig )
......@@ -19,7 +22,7 @@ import Distribution.Verbosity
import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Simple.Utils
( wrapText )
( wrapText, notice )
import qualified Distribution.Client.Setup as Client
configureCommand :: CommandUI (ConfigFlags, ConfigExFlags
......@@ -83,7 +86,12 @@ configureAction (configFlags, configExFlags, installFlags, haddockFlags)
baseCtx <- establishProjectBaseContext verbosity cliConfig
-- Write out the @cabal.project.local@ so it gets picked up by the
-- planning phase.
-- planning phase. If old config exists, then print the contents
-- before overwriting
exists <- doesFileExist "cabal.project.local"
when exists $ do
notice verbosity "'cabal.project.local' file already exists. Now overwriting it."
copyFile "cabal.project.local" "cabal.project.local~"
writeProjectLocalExtraConfig (distDirLayout baseCtx)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment