(handleEvent (publishOneMsg exchange rkey) (suffix args) folder)
hr "BEGIN watching"
if (initialScan args)
- then DO.listDirectory folder >>=
- mapM_ (\fn -> handleFile (publishOneMsg exchange rkey) (suffix args) (folder OS.</> fn))
+ then do
+ folder' <- OS.encodeUtf (BS.unpack folder)
+ DO.listDirectory folder' >>=
+ mapM_ (\fn -> handleFile (publishOneMsg exchange rkey) (suffix args) (folder' OS.</> fn))
else return ()
return (wd,folder)
#endif
#if linux_HOST_OS
-- | Hotfolder event handler
handleEvent ::
- (Maybe RawFilePath -> BL.ByteString -> IO ()) -> [BS.ByteString] -> RawFilePath -> Event -> IO ()
+ (Maybe RawFilePath -> BL.ByteString -> IO ()) -> [BS.ByteString] -> OS.OsPath -> Event -> IO ()
-- just handle closewrite and movedin events
handleEvent func suffixes folder (Closed False (Just fileName) True) =
handleFile func suffixes (folder OS.</> fileName)
-- | Hotfolder file handler
handleFile ::
- (Maybe RawFilePath -> BL.ByteString -> IO ()) -> [BS.ByteString] -> RawFilePath -> IO ()
+ (Maybe RawFilePath -> BL.ByteString -> IO ()) -> [BS.ByteString] -> OS.OsPath -> IO ()
handleFile func suffixes@(_:_) fileName =
if (any (flip BS.isSuffixOf fileName) suffixes) && not ("." `BS.isPrefixOf` fileName)
then handleFile func [] fileName