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 15, 2024
1 parent 2fbfd55 commit b0df28a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 10 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,10 @@ import Distribution.Simple.Utils
, info
, wrapText
)
import Distribution.System
( OS (Windows)
, buildOS
)
import Distribution.Utils.Path hiding
( (<.>)
, (</>)
Expand All @@ -74,6 +78,7 @@ import System.Directory
, listDirectory
, removeDirectoryRecursive
, removeFile
, removePathForcibly
)
import System.FilePath
( (</>)
Expand Down Expand Up @@ -168,7 +173,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
11 changes: 11 additions & 0 deletions changelog.d/pr-10190
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Fix `cabal clean` permissions on Windows
packages: cabal-install
prs: #10190
issues: #10182
significance:

description: {

- `cabal clean` now removes the `dist-newstyle` folder forcibly on Windows.

}

0 comments on commit b0df28a

Please sign in to comment.