Skip to content

Commit

Permalink
Enable listDirChunked for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
harendra-kumar committed Nov 17, 2024
1 parent 4564699 commit 1b52fa3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/ListDir.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ import qualified Streamly.Internal.FileSystem.DirIO as Dir
import qualified Streamly.FileSystem.Handle as Handle
import qualified Streamly.FileSystem.Path as Path
import qualified Streamly.Internal.FileSystem.Path as Path (toChunk)
import qualified Streamly.Internal.FileSystem.Posix.ReadDir as Dir
(readEitherChunks)
#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
import qualified Streamly.Internal.FileSystem.Posix.ReadDir as Dir
(readEitherChunks, readEitherByteChunks)
(readEitherByteChunks)
#endif

#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
Expand Down Expand Up @@ -95,6 +97,7 @@ listDirByteChunked = do

streamDirMaybe :: Either [Path] b -> Maybe (Stream IO (Either [Path] (Array Word8)))
streamDirMaybe = either (Just . Dir.readEitherByteChunks) (const Nothing)
#endif

-- Faster than the listDir implementation below
listDirChunked :: IO ()
Expand Down Expand Up @@ -138,7 +141,6 @@ listDirChunked = do

streamDirMaybe :: Either [Path] b -> Maybe (Stream IO (Either [Path] [Path]))
streamDirMaybe = either (Just . Dir.readEitherChunks) (const Nothing)
#endif

listDir :: IO ()
listDir = do
Expand Down Expand Up @@ -194,7 +196,7 @@ main :: IO ()
main = do
hSetBuffering stdout LineBuffering
listDir
#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
-- listDirChunked
#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
-- listDirByteChunked
#endif

0 comments on commit 1b52fa3

Please sign in to comment.