5 Commits

Author SHA1 Message Date
a0510eaec1 Add stack.yaml 2018-07-19 13:33:55 +08:00
cce2c68cab Update .gitignore 2018-07-19 13:33:55 +08:00
3c5f06f41d Remove redundant imports in tests 2018-07-19 13:33:55 +08:00
6bc5381108 Add hackage-deps badge 2018-06-02 22:38:50 +02:00
ef51863180 Document use of 'getcwd' 2018-04-12 14:28:37 +02:00
9 changed files with 28 additions and 11 deletions

2
.gitignore vendored
View File

@@ -10,3 +10,5 @@ tags
.stack-work/
.cabal-sandbox/
cabal.sandbox.config
dist-newstyle/
.ghc.environment.*

View File

@@ -1,6 +1,6 @@
# HPath
[![Gitter chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hasufell/hpath?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Hackage version](https://img.shields.io/hackage/v/hpath.svg?label=Hackage)](https://hackage.haskell.org/package/hpath) [![Build Status](https://api.travis-ci.org/hasufell/hpath.png?branch=master)](http://travis-ci.org/hasufell/hpath)
[![Gitter chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hasufell/hpath?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Hackage version](https://img.shields.io/hackage/v/hpath.svg?label=Hackage)](https://hackage.haskell.org/package/hpath) [![Build Status](https://api.travis-ci.org/hasufell/hpath.png?branch=master)](http://travis-ci.org/hasufell/hpath) [![Hackage-Deps](https://img.shields.io/hackage-deps/v/hpath.svg)](http://packdeps.haskellers.com/feed?needle=hpath)
Support for well-typed paths in Haskell. Also provides ByteString based filepath
manipulation.

View File

@@ -337,6 +337,8 @@ data CopyMode = Strict -- ^ fail if any target exists
-- Throws in `Strict` CopyMode only:
--
-- - `AlreadyExists` if destination already exists
--
-- Note: may call `getcwd` (only if destination is a relative path)
copyDirRecursive :: Path b1 -- ^ source dir
-> Path b2 -- ^ destination (parent dirs
-- are not automatically created)
@@ -432,7 +434,10 @@ copyDirRecursive fromp destdirp cm rm
--
-- - `UnsatisfiedConstraints` if destination file is non-empty directory
--
-- Note: calls `symlink`
-- Notes:
--
-- - calls `symlink`
-- - calls `getcwd` in Overwrite mode (if destination is a relative path)
recreateSymlink :: Path b1 -- ^ the old symlink file
-> Path b2 -- ^ destination file
-> CopyMode
@@ -486,7 +491,10 @@ recreateSymlink symsource@(MkPath symsourceBS) newsym@(MkPath newsymBS) cm
--
-- - `AlreadyExists` if destination already exists
--
-- Note: calls `sendfile` and possibly `read`/`write` as fallback
-- Notes:
--
-- - calls `sendfile` and possibly `read`/`write` as fallback
-- - may call `getcwd` in Overwrite mode (if destination is a relative path)
copyFile :: Path b1 -- ^ source file
-> Path b2 -- ^ destination file
-> CopyMode
@@ -571,6 +579,8 @@ _copyFile sflags dflags (MkPath fromBS) to@(MkPath toBS)
--
-- * examines filetypes explicitly
-- * calls `copyDirRecursive` for directories
--
-- Note: may call `getcwd` in Overwrite mode (if destination is a relative path)
easyCopy :: Path b1
-> Path b2
-> CopyMode
@@ -751,6 +761,8 @@ createDir fm (MkPath destBS) = createDirectory destBS fm
-- exist and cannot be written to
-- - `AlreadyExists` if destination already exists and
-- is not a directory
--
-- Note: calls `getcwd` if the input path is a relative path
createDirRecursive :: FileMode -> Path b -> IO ()
createDirRecursive fm p =
toAbs p >>= go
@@ -846,7 +858,10 @@ renameFile fromf@(MkPath fromfBS) tof@(MkPath tofBS) = do
--
-- - `AlreadyExists` if destination already exists
--
-- Note: calls `rename` (but does not allow to rename over existing files)
-- Notes:
--
-- - calls `rename` (but does not allow to rename over existing files)
-- - calls `getcwd` in Overwrite mode if destination is a relative path
moveFile :: Path b1 -- ^ file to move
-> Path b2 -- ^ destination
-> CopyMode

7
stack.yaml Normal file
View File

@@ -0,0 +1,7 @@
resolver: lts-12.1
packages:
- '.'
extra-deps:
- IfElse-0.85

View File

@@ -13,7 +13,6 @@ import GHC.IO.Exception
(
IOErrorType(..)
)
import System.Process
import Utils

View File

@@ -13,7 +13,6 @@ import GHC.IO.Exception
(
IOErrorType(..)
)
import System.Process
import Utils

View File

@@ -13,7 +13,6 @@ import GHC.IO.Exception
(
IOErrorType(..)
)
import System.Process
import Utils

View File

@@ -13,7 +13,6 @@ import GHC.IO.Exception
(
IOErrorType(..)
)
import System.Process
import Utils

View File

@@ -61,9 +61,6 @@ import System.Posix.Files.ByteString
, unionFileModes
)
import qualified "unix" System.Posix.IO.ByteString as SPI
import qualified "unix-bytestring" System.Posix.IO.ByteString as SPB
baseTmpDir :: ByteString