fsnotify-0.0.11: Cross platform library for file change notification.

Safe HaskellNone
LanguageHaskell98

System.FSNotify.Devel

Synopsis

Documentation

treeExtAny Source

Arguments

:: WatchManager 
-> FilePath

Directory to watch

-> Text

extension

-> (FilePath -> IO ())

action to run on file

-> IO () 

In the given directory tree, for files with the given file extension perform the given action

treeExtExists Source

Arguments

:: WatchManager 
-> FilePath

Directory to watch

-> Text

extension

-> (FilePath -> IO ())

action to run on file

-> IO () 

Example of compiling scss files with compass

compass :: WatchManager -> FilePath -> IO ()
compass man dir = do
 putStrLn $ "compass " ++ encodeString dir
 treeExtExists man dir "scss" $ fp ->
   when ("deploy" notElem splitDirectories fp) $ do
    let d = encodeString $ head (splitDirectories rel)
    system "cd " ++ d ++ "&& bundle exec compass compile"
 return ()

In the given directory tree, watch for any Added and Modified events (but ignore Removed events) for files with the given file extension perform the given action

doAllEvents :: Monad m => (FilePath -> m ()) -> Event -> m () Source