diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index 3a2235d..a152483 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -132,7 +132,7 @@ jobs: with: ghc-version: ${{ matrix.ghc_version }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 name: Restore cache ~/.cabal, ~/.stack, .stack-work, ~/.ghc, ~/.local with: path: | diff --git a/src/Streamly/Coreutils/Cp.hs b/src/Streamly/Coreutils/Cp.hs index 5270d65..21f210e 100644 --- a/src/Streamly/Coreutils/Cp.hs +++ b/src/Streamly/Coreutils/Cp.hs @@ -24,7 +24,8 @@ where import Control.Monad (when) import Data.Function ((&)) import System.PosixCompat.Files (createLink) -import qualified Streamly.Internal.FileSystem.File as File +import qualified Streamly.Internal.FileSystem.FileIO as File +import qualified Streamly.FileSystem.Path as Path import Streamly.Coreutils.FileTest @@ -40,6 +41,15 @@ import Streamly.Coreutils.FileTest -- Ideally, cp should not hard link as we have ln for hard linking, but it can -- be useful when we need to hard link recursively. +-- Path vs FilePath: +-- +-- Ideally, we want to use "Path" instead of "FilePath" in this module. However, +-- this change isn't very straightforward at the moment due to the dependence on +-- System.PosixCompat.Files. +-- +-- Streamly.Coreutils.FileTest relies on System.PosixCompat.Files for most of +-- its APIs. + -- | Specify the overwrite behavior of copy. data CpOverwrite = OverwriteNever -- ^ Do not overwrite when destination file exists @@ -88,7 +98,10 @@ cpMethod opt options = options { optCopyMethod = opt } cpCopy :: CpMethod -> FilePath -> FilePath -> IO () cpCopy method src dest = case method of - CopyContents -> File.readChunks src & File.fromChunks dest + CopyContents -> do + srcP <- Path.fromString src + destP <- Path.fromString dest + File.readChunks srcP & File.fromChunks destP HardLink -> createLink src dest SymbolicLink -> error "Unimplemented" CopyClone -> error "Unimplemented" diff --git a/stack.yaml b/stack.yaml index 77c0c6d..be301ad 100644 --- a/stack.yaml +++ b/stack.yaml @@ -7,9 +7,9 @@ packages: extra-deps: - github: composewell/streamly - commit: "4e2fccbe2a6a4c168801fffcdb17aaec1466f838" + commit: "e57585dfac5d9d1b57c52d8f3a69ed3809a6ae63" - github: composewell/streamly - commit: "4e2fccbe2a6a4c168801fffcdb17aaec1466f838" + commit: "e57585dfac5d9d1b57c52d8f3a69ed3809a6ae63" subdirs: - core