fsnotify 0.0.4 → 0.0.5
raw patch · 3 files changed
+57/−42 lines, 3 filesdep +Cabaldep +Globdep +QuickCheckdep ~Win32-notifydep ~basedep ~hinotifyPVP ok
version bump matches the API change (PVP)
Dependencies added: Cabal, Glob, QuickCheck, bytestring, ghc, hspec, random, uniqueid
Dependency ranges changed: Win32-notify, base, hinotify, system-fileio, system-filepath, text
API changes (from Hackage documentation)
Files
- fsnotify.cabal +34/−36
- src/System/FSNotify/Win32.hs +12/−6
- test/main.hs +11/−0
fsnotify.cabal view
@@ -1,5 +1,5 @@ Name: fsnotify-Version: 0.0.4+Version: 0.0.5 Author: Mark Dittmer <mark.s.dittmer@gmail.com> Maintainer: Mark Dittmer <mark.s.dittmer@gmail.com>, Greg Weber <greg@gregweber.info> License: BSD3@@ -43,7 +43,7 @@ if os(windows) CPP-Options: -DOS_Win32 Other-Modules: System.FSNotify.Win32- Build-Depends: Win32-notify == 0.2+ Build-Depends: Win32-notify >= 0.3 else if os(darwin) CPP-Options: -DOS_Mac@@ -63,40 +63,38 @@ -- , text >= 0.11.0 -- , time >= 1.4 --- DISABLED: older Cabal lib versions have a bug which means they fall--- over when looking at test-suite sections that contain conditionals--- Test-Suite test--- Type: exitcode-stdio-1.0--- Main-Is: main.hs--- -- Type: detailed-0.9--- -- Test-Module: Tests--- Hs-Source-Dirs: test, src--- GHC-Options: -Wall -threaded--- Build-depends: base >= 4.3.1.0--- , bytestring >= 0.9.2.1--- , Cabal >= 1.14.0--- , containers >= 0.4.2.1--- , directory >= 1.1.0.2--- , Glob >= 0.7.1--- , hspec >= 1.3.0--- , random >= 1.0.1.1--- , system-filepath >= 0.4.6--- , system-fileio >= 0.3.7--- , text >= 0.10--- , time >= 1.4--- , QuickCheck >= 2.4.2--- , uniqueid >= 0.1.1--- if os(linux)--- CPP-Options: -DOS_Linux--- Build-Depends: hinotify == 0.3.2--- else--- if os(windows)--- CPP-Options: -DOS_Win32--- Build-Depends: Win32-notify == 0.2, ghc >= 7.4.2--- else--- if os(darwin)--- CPP-Options: -DOS_Mac--- Build-Depends: hfsevents >= 0.1.3+Test-Suite test+ Type: exitcode-stdio-1.0+ Main-Is: main.hs+ -- Type: detailed-0.9+ -- Test-Module: Tests+ Hs-Source-Dirs: test, src+ GHC-Options: -Wall -threaded+ Build-depends: base >= 4.3.1.0+ , bytestring >= 0.9.2.1+ , Cabal >= 1.14.0+ , containers >= 0.4.2.1+ , directory >= 1.1.0.2+ , Glob >= 0.7.1+ , hspec >= 1.3.0+ , random >= 1.0.1.1+ , system-filepath >= 0.4.6+ , system-fileio >= 0.3.7+ , text >= 0.10+ , time >= 1.4+ , QuickCheck >= 2.4.2+ , uniqueid >= 0.1.1+ if os(linux)+ CPP-Options: -DOS_Linux+ Build-Depends: hinotify == 0.3.2+ else+ if os(windows)+ CPP-Options: -DOS_Win32+ Build-Depends: Win32-notify >= 0.3, ghc >= 7.4.2+ else+ if os(darwin)+ CPP-Options: -DOS_Mac+ Build-Depends: hfsevents >= 0.1.3 Source-Repository head
src/System/FSNotify/Win32.hs view
@@ -29,18 +29,24 @@ void :: IO () void = return () -fsnEvents :: UTCTime -> WNo.Event -> [Event]-fsnEvents timestamp (WNo.Created False name) = [Added (fp name) timestamp]+-- Win32-notify has (temporarily?) dropped support for Renamed events.+fsnEvent :: UTCTime -> WNo.Event -> Maybe Event+fsnEvent timestamp (WNo.Created False name) = Just $ Added (fp name) timestamp+fsnEvent timestamp (WNo.Modified False name) = Just $ Modified (fp name) timestamp+fsnEvent timestamp (WNo.Deleted False name) = Just $ Removed (fp name) timestamp+fsnEvent _ _ = Nothing+{- fsnEvents timestamp (WNo.Renamed False (Just oldName) newName) = [Removed (fp oldName) timestamp, Added (fp newName) timestamp] fsnEvents timestamp (WNo.Renamed False Nothing newName) = [Added (fp newName) timestamp]-fsnEvents timestamp (WNo.Modified False (Just name)) = [Modified (fp name) timestamp]-fsnEvents timestamp (WNo.Deleted False name) = [Removed (fp name) timestamp]-fsnEvents _ _ = []+-} handleWNoEvent :: ActionPredicate -> EventChannel -> DebouncePayload -> WNo.Event -> IO () handleWNoEvent actPred chan dbp inoEvent = do currentTime <- getCurrentTime- mapM_ (handleEvent actPred chan dbp) (fsnEvents currentTime inoEvent)+ let maybeEvent = fsnEvent currentTime inoEvent+ case maybeEvent of+ Just evt -> handleEvent actPred chan dbp evt+ Nothing -> void handleEvent :: ActionPredicate -> EventChannel -> DebouncePayload -> Event -> IO () handleEvent actPred chan dbp event = when (actPred event) $ case dbp of
+ test/main.hs view
@@ -0,0 +1,11 @@+module Main where++import Test.Hspec (hspec, Spec)+import qualified Path as P+import qualified FSNotify as FSN++main :: IO ()+main = hspec spec++spec :: Spec+spec = P.spec >> FSN.spec