@@ -193,6 +193,7 @@ import qualified Streamly.Internal.Data.Fold as FL
193193import qualified Streamly.Internal.Data.Parser as PR
194194import qualified Streamly.Internal.Data.Stream.IsStream as S
195195import qualified Streamly.Internal.FileSystem.Dir as Dir
196+import qualified System.Directory as Dir
196197import qualified Streamly.Internal.FileSystem.Handle as FH
197198import qualified Streamly.Internal.Unicode.Stream as U
198199
@@ -745,7 +746,8 @@ addToWatch cfg@Config{..} watch0@(Watch handle wdMap) root0 path0 = do
745746 --
746747 -- XXX toDirs currently uses paths as String, we need to convert it
747748 -- to "/" separated by byte arrays.
748− when watchRec $ do
749+ pathIsDir <- Dir.doesDirectoryExist $ utf8ToString absPath
750+ when (watchRec && pathIsDir) $ do
749751 S.mapM_ (\p -> addToWatch cfg watch0 root (appendPaths path p))
750752 $ S.mapM toUtf8
751753 $ Dir.toDirs $ utf8ToString absPath