Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
17 changes: 15 additions & 2 deletions src/Streamly/Coreutils/Cp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ packages:

extra-deps:
- github: composewell/streamly
commit: "4e2fccbe2a6a4c168801fffcdb17aaec1466f838"
commit: "e57585dfac5d9d1b57c52d8f3a69ed3809a6ae63"
- github: composewell/streamly
commit: "4e2fccbe2a6a4c168801fffcdb17aaec1466f838"
commit: "e57585dfac5d9d1b57c52d8f3a69ed3809a6ae63"
subdirs:
- core

Expand Down
Loading