Skip to content

Commit

Permalink
Remove path forcibly on cabal clean on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Jul 9, 2024
1 parent 2fbfd55 commit 0dcc394
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cabal-install/src/Distribution/Client/CmdClean.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ import Distribution.Simple.Utils
, info
, wrapText
)

import Distribution.System
( OS (Windows)
, buildOS
)
import Distribution.Utils.Path hiding
( (<.>)
, (</>)
Expand All @@ -74,6 +79,7 @@ import System.Directory
, listDirectory
, removeDirectoryRecursive
, removeFile
, removePathForcibly
)
import System.FilePath
( (</>)
Expand Down Expand Up @@ -168,7 +174,11 @@ cleanAction (ProjectFlags{..}, CleanFlags{..}) extraArgs _ = do
let distRoot = distDirectory distLayout

info verbosity ("Deleting dist-newstyle (" ++ distRoot ++ ")")
handleDoesNotExist () $ removeDirectoryRecursive distRoot
handleDoesNotExist () $
if buildOS == Windows
then -- Windows can't delete some git files #10182
removePathForcibly distRoot
else removeDirectoryRecursive distRoot

removeEnvFiles $ distProjectRootDirectory distLayout

Expand Down

0 comments on commit 0dcc394

Please sign in to comment.