mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-10-06 05:07:07 +03:00
Fix inappropriate type (Not a directory) error
In Linux module for File paths in recursive mode.
This commit is contained in:
parent
dd4774b530
commit
842d0ca9e7
@ -193,6 +193,7 @@ import qualified Streamly.Internal.Data.Fold as FL
|
||||
import qualified Streamly.Internal.Data.Parser as PR
|
||||
import qualified Streamly.Internal.Data.Stream.IsStream as S
|
||||
import qualified Streamly.Internal.FileSystem.Dir as Dir
|
||||
import qualified System.Directory as Dir
|
||||
import qualified Streamly.Internal.FileSystem.Handle as FH
|
||||
import qualified Streamly.Internal.Unicode.Stream as U
|
||||
|
||||
@ -745,7 +746,8 @@ addToWatch cfg@Config{..} watch0@(Watch handle wdMap) root0 path0 = do
|
||||
--
|
||||
-- XXX toDirs currently uses paths as String, we need to convert it
|
||||
-- to "/" separated by byte arrays.
|
||||
when watchRec $ do
|
||||
pathIsDir <- Dir.doesDirectoryExist $ utf8ToString absPath
|
||||
when (watchRec && pathIsDir) $ do
|
||||
S.mapM_ (\p -> addToWatch cfg watch0 root (appendPaths path p))
|
||||
$ S.mapM toUtf8
|
||||
$ Dir.toDirs $ utf8ToString absPath
|
||||
|
@ -12,13 +12,13 @@
|
||||
--
|
||||
-- =Overview
|
||||
--
|
||||
-- Use 'watchTrees'or 'watchPaths' with a list of file system paths you want to
|
||||
-- watch as argument. It returns a stream of 'Event' representing the file
|
||||
-- system events occurring under the watched paths.
|
||||
-- Use 'watchRecursive'or 'watch' with a list of file system dir paths you
|
||||
-- want to watch as argument. It returns a stream of 'Event' representing the
|
||||
-- file system events occurring under the watched paths.
|
||||
--
|
||||
-- @
|
||||
-- {-\# LANGUAGE MagicHash #-}
|
||||
-- Stream.mapM_ (putStrLn . 'showEvent') $ 'watchTrees' [Array.fromCString\# "path"#]
|
||||
-- Stream.mapM_ (putStrLn . 'showEvent') $ 'watchRecursive' [Array.fromCString\# "path"#]
|
||||
-- @
|
||||
--
|
||||
-- 'Event' is an opaque type. Accessor functions (e.g. 'showEvent' above)
|
||||
|
@ -149,4 +149,4 @@ main = do
|
||||
runRec SymLinkOrigPath recSymTests
|
||||
-- XXX This fails with exceptions, ideally it should work the same as in
|
||||
-- non-recursive mode
|
||||
-- runRec FileType fileRootTests
|
||||
runRec FileType fileRootTests
|
||||
|
@ -38,6 +38,7 @@ main = do
|
||||
-- TODO create/modify/delete/move with root path as a regular file, copy
|
||||
-- from macOS tests
|
||||
-- run FileType fileRootTests
|
||||
-- Windows watch events only supports dir path as root.
|
||||
|
||||
let recTests =
|
||||
[ dirCreateWithParent "subdir\\dir"
|
||||
|
Loading…
Reference in New Issue
Block a user