fdo-trash 0.0.0.0 → 0.0.0.1
raw patch · 3 files changed
+31/−5 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Freedesktop.Trash: genTrashFile :: FilePath -> FilePath -> TimeZone -> FilePath -> IO (Maybe TrashFile)
+ Freedesktop.Trash: genTrashFile :: [Char] -> [Char] -> TimeZone -> [Char] -> IO (Maybe TrashFile)
Files
- Freedesktop/Trash.hs +15/−4
- README +13/−0
- fdo-trash.cabal +3/−1
Freedesktop/Trash.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Freedesktop.Trash ( TrashFile(..), trashGetOrphans,@@ -27,8 +29,17 @@ import Data.Algorithm.Diff(getDiff,DI(..)) import Data.List(sort) import System.Posix.Files(fileSize,getSymbolicLinkStatus,isRegularFile,isDirectory,rename,removeLink,fileExist)-import qualified System.IO.Error as E+#if MIN_VERSION_base(4,6,0)+import System.IO.Error(catchIOError,tryIOError)+eCatch = catchIOError+eTry = tryIOError+#else+import qualified System.IO.Error(try, catch)+eCatch = System.IO.Error.catch+eTry = System.IO.Error.try+#endif + data TrashFile = TrashFile { infoPath :: FilePath, dataPath :: FilePath,@@ -109,8 +120,8 @@ encodeTrashPath = encString False ok_url -doRemoveFile file = E.catch (removeDirectoryRecursive file)- (\_ -> E.try (removeLink file) >> return ())+doRemoveFile file = eCatch (removeDirectoryRecursive file)+ (\_ -> eTry (removeLink file) >> return ()) >> return () expungeTrash file = do@@ -161,12 +172,12 @@ doMoveToTrash trashFile = do timeZone <- getCurrentTimeZone+ rename (origPath trashFile) (dataPath trashFile) writeFile (infoPath trashFile) ( trashHeaderString ++ "Path=" ++ (encodeTrashPath $ origPath trashFile) ++ "\n" ++ "DeletionDate=" ++ formatTrashDate (utcToLocalTime timeZone $ deleteTime trashFile) ++ "\n" )- rename (origPath trashFile) (dataPath trashFile) moveToTrash trashFile = do yes <- fileExist $ origPath trashFile
+ README view
@@ -0,0 +1,13 @@+The package creates utility called fdo-trash and a small library that provides+much of the same functionality.++Fdo trash has 3 utilities, fdo-rm, fdo-unrm and fdo-purge. These executable can+be invoked by symlinking fdo-trash to properly named file (like busybox) or via+fdo-trash with applet name (eg. fdo-trash rm [file]).++Use man/genManPages to generate man pages for the utilities. (requires+help2man).++fdo-rm moves files to freedesktop trash, fdo-unrm moves them back and fdo-purge+removes obsolete files from trash.+
fdo-trash.cabal view
@@ -1,5 +1,5 @@ name: fdo-trash-version: 0.0.0.0+version: 0.0.0.1 copyright: (c) 2012 Emil Karlson license: BSD3 author: Emil Karlson <jekarlson@gmail.com>@@ -7,6 +7,8 @@ category: Desktop synopsis: Utilities related to freedesktop Trash standard. description: Contains utilities to unrm from trash, purge old files from trash and move files to trash.+homepage: https://github.com/jkarlson/fdo-trash+bug-reports: https://github.com/jkarlson/fdo-trash/issues stability: provisional build-type: Simple cabal-version: >= 1.8