]> woffs.de Git - fd/haskell-amqp-utils.git/commitdiff
WiP rabbit hole ospath
authorFrank Doepper <[email protected]>
Mon, 21 Aug 2023 15:28:03 +0000 (17:28 +0200)
committerFrank Doepper <[email protected]>
Mon, 21 Aug 2023 15:28:03 +0000 (17:28 +0200)
agitprop.hs

index cb1db3906503a59ac6b123d933c5de74d4c8bfa5..445f686f80e0aca7bef4a69b5119146c4f49a7f3 100644 (file)
@@ -123,8 +123,10 @@ watchHotfolder args publishOneMsg (folder, exchange, rkey) = do
      (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
@@ -152,7 +154,7 @@ confirmCallback (deliveryTag, isAll, ackType) =
 #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)
@@ -162,7 +164,7 @@ handleEvent _ _ _ _ = return ()
 
 -- | 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