LIB: improve symlink handling

This commit is contained in:
2015-12-21 18:32:53 +01:00
parent 988350967a
commit 433cb164a6
4 changed files with 100 additions and 32 deletions

View File

@@ -115,6 +115,10 @@ open row mygui myview =
del :: Row -> MyGUI -> MyView -> IO ()
del row mygui myview =
case row of
r@(_ :/ Dir { dir = FileInfo { isSymbolicLink = True } }) ->
delSym r
r@(_ :/ RegFile { regFile = FileInfo { isSymbolicLink = True } }) ->
delSym r
r@(_ :/ Dir _ _) -> do
let fp = fullPath r
subADT <- readDirectory fp
@@ -134,6 +138,13 @@ del row mygui myview =
withConfirmationDialog cmsg
$ withErrorDialog (deleteFile fp
>> refreshTreeView mygui myview Nothing)
where
delSym r = do
let fp = fullPath r
cmsg = "Really delete symlink \"" ++ fp ++ "\"?"
withConfirmationDialog cmsg
$ withErrorDialog (deleteSymlink fp
>> refreshTreeView mygui myview Nothing)
-- |Supposed to be used with 'withRow'. Initializes a file copy operation.