File tree Expand file tree Collapse file tree
core/src/Streamly/Internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,8 +52,7 @@ getCurrentDirectory = modifyError $ do
5252
5353-- | Set the current working directory.
5454setCurrentDirectory :: Path -> IO ()
55- setCurrentDirectory p = modifyError $
56- Syscall. setCwd (toArray p)
55+ setCurrentDirectory p = modifyError $ Syscall. setCwd p
5756
5857 where
5958
Original file line number Diff line number Diff line change @@ -35,11 +35,12 @@ import Foreign.Storable (peekByteOff)
3535import GHC.Base (Addr ##)
3636import GHC.Ptr (Ptr (.. ))
3737import Streamly.Internal.Data.Array.Type (Array (.. ))
38- import qualified Streamly.Internal.Data.Array as Array
3938import qualified Streamly.Internal.Data.MutByteArray as MutByteArray
4039import Streamly.Internal.Data.MutByteArray.Type
4140 (MutByteArray , PinnedState (.. ), unsafeAsPtr )
4241import Streamly.Internal.Syscall.Common (retry )
42+ import Streamly.Internal.FileSystem.PosixPath (PosixPath )
43+ import qualified Streamly.Internal.FileSystem.PosixPath as Path
4344import System.Posix.Types (CMode )
4445
4546#include <sys/stat.h>
@@ -81,9 +82,9 @@ getCwd = do
8182foreign import ccall unsafe " chdir"
8283 c_chdir :: CString -> IO CInt
8384
84- setCwd :: Array Word8 -> IO ()
85- setCwd arr =
86- Array. asCStringUnsafe arr $
85+ setCwd :: PosixPath -> IO ()
86+ setCwd path =
87+ Path. asCString path $
8788 throwErrnoIfMinus1_ " setCwd" . c_chdir
8889
8990--------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ openDirStreamCString s = do
155155-- {-# INLINE openDirStream #-}
156156openDirStream :: PosixPath -> IO DirStream
157157openDirStream p =
158- Array. asCStringUnsafe ( Path. toArray p) $ \ s -> do
158+ Path. asCString p $ \ s -> do
159159 -- openDirStreamCString s
160160 dirp <- throwErrnoPathIfNullRetry " openDirStream" p $ c_opendir s
161161 return (DirStream dirp)
@@ -214,7 +214,7 @@ statEntryType conf parent dname = do
214214 -- XXX We can create a pinned array right here since the next call pins
215215 -- it anyway.
216216 path <- Path. appendCString parent dname
217- Array. asCStringUnsafe ( Path. toArray path) $ \ cStr -> do
217+ Path. asCString path $ \ cStr -> do
218218 res <- stat (_followSymlinks conf) cStr
219219 case res of
220220 Right mode -> pure $
You can’t perform that action at this time.
0 commit comments