Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghcup-hs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
ghcup-hs
Commits
33eaa765
Commit
33eaa765
authored
4 years ago
by
Arjun Kathuria
Browse files
Options
Downloads
Patches
Plain Diff
adds better error handling when removing files and dirs in rmGhcupDirs function
parent
3b3dde84
No related branches found
No related tags found
1 merge request
!101
[WIP] Feature "nuke"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/GHCup.hs
+5
-16
5 additions, 16 deletions
lib/GHCup.hs
with
5 additions
and
16 deletions
lib/GHCup.hs
+
5
−
16
View file @
33eaa765
...
...
@@ -1355,31 +1355,20 @@ rmGhcupDirs = do
rmCacheDir
cacheDir
=
do
$
logInfo
"removing ghcup cache Dir"
contents
<-
liftIO
$
listDirectory
cacheDir
forM_
contents
removeIf
File
forM_
contents
delete
File
removeDirIfEmpty
cacheDir
rmLogsDir
logsDir
=
do
$
logInfo
"removing ghcup logs Dir"
contents
<-
liftIO
$
listDirectory
logsDir
forM_
contents
removeIf
File
forM_
contents
delete
File
removeDirIfEmpty
logsDir
removeIfFile
filepath
=
do
isFile
<-
checkIfSymlink
filepath
isSymlink
<-
checkIfRegularFile
filepath
if
isFile
&&
not
isSymlink
then
liftIO
$
removeFile
filepath
else
pure
()
checkIfSymlink
filepath
=
liftIO
$
pathIsSymbolicLink
filepath
checkIfRegularFile
filepath
=
liftIO
$
doesFileExist
filepath
deleteFile
filepath
=
do
hideError
InappropriateType
$
liftIO
$
removeFile
filepath
removeDirIfEmpty
filepath
=
liftIO
$
removeDirectory
filepath
hideError
UnsatisfiedConstraints
$
liftIO
$
removeDirectory
filepath
------------------
--[ Debug info ]--
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment