GUI: allow deletion of non-empty directories
This commit is contained in:
parent
9fbe43e7d5
commit
ff40102fbe
@ -236,12 +236,16 @@ open row mygui myview = case row of
|
|||||||
-- |Supposed to be used with `withRow`. Deletes a file or directory.
|
-- |Supposed to be used with `withRow`. Deletes a file or directory.
|
||||||
del :: DTInfoZipper -> MyGUI -> MyView -> IO ()
|
del :: DTInfoZipper -> MyGUI -> MyView -> IO ()
|
||||||
del row mygui myview = case row of
|
del row mygui myview = case row of
|
||||||
dz@(Dir {}, _) -> do
|
dz@(Dir _ cs _, _) -> do
|
||||||
let fp = getFullPath dz
|
let fp = getFullPath dz
|
||||||
cmsg = "Really delete directory \"" ++ fp ++ "\"?"
|
cmsg = "Really delete directory \"" ++ fp ++ "\"?"
|
||||||
withConfirmationDialog cmsg
|
cmsg2 = "Directory \"" ++ fp ++ "\" is not empty! Delete all contents?"
|
||||||
$ withErrorDialog (deleteDir dz
|
withConfirmationDialog cmsg $
|
||||||
|
if null cs
|
||||||
|
then withErrorDialog (deleteDir dz
|
||||||
>> refreshTreeView mygui myview Nothing)
|
>> refreshTreeView mygui myview Nothing)
|
||||||
|
else withConfirmationDialog cmsg2 $ withErrorDialog
|
||||||
|
(deleteDirRecursive dz >> refreshTreeView mygui myview Nothing)
|
||||||
dz@(File {}, _) -> do
|
dz@(File {}, _) -> do
|
||||||
let fp = getFullPath dz
|
let fp = getFullPath dz
|
||||||
cmsg = "Really delete file \"" ++ fp ++ "\"?"
|
cmsg = "Really delete file \"" ++ fp ++ "\"?"
|
||||||
|
Loading…
Reference in New Issue
Block a user