From c32290050878037da62210fbeff0362f7e6e65ce Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Sun, 18 Jun 2023 00:35:33 +0200 Subject: [PATCH] etc/diskspace: include dir in error when more than one subdir [skip ci] --- etc/diskspace/remove-old-stack-work-libs.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/diskspace/remove-old-stack-work-libs.hs b/etc/diskspace/remove-old-stack-work-libs.hs index bdb8ada0..6628fb08 100755 --- a/etc/diskspace/remove-old-stack-work-libs.hs +++ b/etc/diskspace/remove-old-stack-work-libs.hs @@ -98,10 +98,14 @@ withOneDirectory_ act = do ls <- listDirectory "." case ls of [l] -> withCurrentDirectory l act - _ -> error $ "more than one directory found: " ++ unwords ls + _ -> do + cwd <- getCurrentDirectory + error $ "more than one directory found in " ++ cwd ++ ": " ++ unwords ls withOneDirectory act = do ls <- listDirectory "." case ls of [l] -> withCurrentDirectory l $ act l - _ -> error $ "more than one directory found: " ++ unwords ls + _ -> do + cwd <- getCurrentDirectory + error $ "more than one directory found in " ++ cwd ++ ": " ++ unwords ls