From f04efbad3ed6f5cbc215f8aa72b1bd0203712768 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sat, 19 Feb 2011 17:04:50 +0100 Subject: Preview/INotify now works --- src/Hakyll/Web/Preview/INotify.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Hakyll/Web') diff --git a/src/Hakyll/Web/Preview/INotify.hs b/src/Hakyll/Web/Preview/INotify.hs index 9af6def..e21b767 100644 --- a/src/Hakyll/Web/Preview/INotify.hs +++ b/src/Hakyll/Web/Preview/INotify.hs @@ -8,6 +8,7 @@ import Control.Monad (forM_, when) import Data.Set (Set) import qualified Data.Set as S import System.FilePath (takeDirectory, ()) +import Data.List (isPrefixOf) import System.INotify @@ -38,9 +39,9 @@ previewPoll _ resources callback = do notEmpty x = x -- Execute the callback when path is known - ifResource path = when (path `S.member` paths) $ do - putStrLn $ "Changed: " ++ path - callback + ifResource path = + let path' = if "./" `isPrefixOf` path then drop 2 path else path + in when (path' `S.member` paths) callback -- Add a watcher for every directory forM_ directories $ \directory -> do -- cgit v1.2.3