summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-19 17:04:50 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-19 17:04:50 +0100
commitf04efbad3ed6f5cbc215f8aa72b1bd0203712768 (patch)
treec32ff0981e158739ea1bca085f1e0f3d8a73c4e6 /src/Hakyll/Web
parentb89aad6178b151a859469a3ae5c6ed4e6f57cad6 (diff)
downloadhakyll-f04efbad3ed6f5cbc215f8aa72b1bd0203712768.tar.gz
Preview/INotify now works
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r--src/Hakyll/Web/Preview/INotify.hs7
1 files changed, 4 insertions, 3 deletions
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