From d9d102fa2a954f060114aa5cb2a442e3731fd5d8 Mon Sep 17 00:00:00 2001 From: Ignat Insarov Date: Fri, 24 Mar 2023 08:02:31 +0300 Subject: [PATCH] Make backup location better. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make it a dot file so that it does not clutter the view. * Make it say _«backup»_. Hopefully it would be easier to understand the purpose of this file when it is named this way. --- executables/cabal-prettify/Main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/executables/cabal-prettify/Main.hs b/executables/cabal-prettify/Main.hs index 22931c6..f82dffc 100644 --- a/executables/cabal-prettify/Main.hs +++ b/executables/cabal-prettify/Main.hs @@ -117,7 +117,8 @@ runAction Action {settings = Settings {..}, ..} = do runEffects :: FilePath → ByteArray → [(FilePath, FilePath)] → IO ( ) runEffects target result moves = do - renameFile target (target <.> "previous") + let backup = dropFileName target "." <> takeFileName target <.> "backup" + renameFile target backup ByteArray.writeFile target result forM_ moves \ (sourceSubdirectory, targetSubdirectory) → let sourceDirectory = (dropFileName target sourceSubdirectory)