Commit Graph

31 Commits

Author SHA1 Message Date
Julian Ospald 69dbf6714d
Relicense to BSD3 2016-06-04 00:39:03 +02:00
Julian Ospald bb590a7692
Improve documentation 2016-05-31 16:21:14 +02:00
Julian Ospald 82ea75cc88
Small documentation fix 2016-05-30 17:16:24 +02:00
Julian Ospald 08de2ebefb
Move RelC class from HPath.Internal to HPath 2016-05-30 13:02:34 +02:00
Julian Ospald 51da8bf5c2
HPath.IO: add createSymlink 2016-05-29 17:28:12 +02:00
Julian Ospald 4032629407
Add TODO 2016-05-24 03:26:07 +02:00
Julian Ospald ae9a806c2e
Fix to latest sendfile version to simplify imports 2016-05-24 03:13:36 +02:00
Julian Ospald 47dd729e8a
Small documentation improvements 2016-05-22 13:41:39 +02:00
Julian Ospald 620550dab4
Minor documentation fixes 2016-05-22 13:28:20 +02:00
Julian Ospald 8fec862304
Rm redundant import 2016-05-18 13:48:38 +02:00
Julian Ospald 797dcaf725
Backport changes from posix-paths PR:
* add isFileName
* add hasParentDir
* add hiddenFile
* add our own openFd version for more control
* small documentation improvements
* add a getDirectoryContents' version that works on Fd
* fix linting warnings
* lift version constraints in benchmark

Also adjust HPath.IO to work with the new API.
2016-05-18 04:11:40 +02:00
Julian Ospald 0fa66cd581
Use sendfile for copying and read/write as fallback 2016-05-18 03:47:39 +02:00
Julian Ospald ee3ace362b
HPath.IO: minor doc fix 2016-05-10 12:05:55 +02:00
Julian Ospald 05fcad14f1
HPath.IO.Errors: minor documentation fix 2016-05-10 02:02:05 +02:00
Julian Ospald f841a53985
HPath.IO: pretty 2016-05-10 00:36:51 +02:00
Julian Ospald eb27c368e6
HPath.IO.Errors: explicit exports, improve haddock compat 2016-05-10 00:35:33 +02:00
Julian Ospald c76df7f159
HPath.IO: small cleanup 2016-05-10 00:28:04 +02:00
Julian Ospald 613754c58f
HPath.IO: just do 'return ()' on unsupported file types where possible
Breaking the callstack with an ioError seems a bit harsh here.
2016-05-10 00:27:46 +02:00
Julian Ospald d8b0b99edf
HPath.IO.Errors: provide all exception constructor checkers 2016-05-10 00:13:14 +02:00
Julian Ospald 794c3a2fc4
HPath.IO.Errors: remove obsolete HPathIOException constructors 2016-05-10 00:12:43 +02:00
Julian Ospald 8a28a5dd0f
HPath.IO.Errors: fix throwDestinationInSource
'canonicalizePath' was missing, making this function far less reliable.
In order for this to work we have to work around circular imports
with a IO.hs-boot file.
2016-05-10 00:11:42 +02:00
Julian Ospald 930b021a32
Add missing (<$>) imports 2016-05-09 18:53:26 +02:00
Julian Ospald 14b48515a2
Add TODO to _copyFile 2016-05-09 18:15:05 +02:00
Julian Ospald 820bf8814d
Fix build with GHC versions prior 7.10.x 2016-05-09 18:14:08 +02:00
Julian Ospald f27becc4df
Cleanup, improve docs 2016-05-09 17:37:16 +02:00
Julian Ospald 86a4b9ade2
Add IO modules, previously from HSFM 2016-05-09 16:53:31 +02:00
Julian Ospald 6638cd8cc1
Create HPath.IO module, adding canonicalizePath again 2016-05-09 14:40:30 +02:00
Julian Ospald 7e8c745e35
Clean up, rewrite stuff 2016-04-16 18:17:44 +02:00
Julian Ospald 491efe44a3
Use ByteString for paths instead of String 2016-04-04 17:29:35 +02:00
Julian Ospald 3c3a2d2766
Switch to new layout 2016-03-30 02:47:42 +02:00
Julian Ospald d15e4b8ad9 Fork chrisdone's path library
I wasn't happy with the way it dealt with Dir vs File things. In his
version of the library, a `Path b Dir` always ends with a trailing
path separator and `Path b File` never ends with a trailing path separator.

IMO, it is nonsensical to make a Dir vs File distinction on path level,
although it first seems nice.
Some of the reasons are:
* a path is just that: a path. It is completely disconnected from IO level
  and even if a `Dir`/`File` type theoretically allows us to say "this path
  ought to point to a file", there is literally zero guarantee that it will
  hold true at runtime. So this basically gives a false feeling of a
  type-safe file distinction.
* it's imprecise about Dir vs File distinction, which makes it even worse,
  because a directory is also a file (just not a regular file). Add symlinks
  to that and the confusion is complete.
* it makes the API oddly complicated for use cases where we basically don't
  care (yet) whether something turns out to be a directory or not

Still, it comes also with a few perks:
* it simplifies some functions, because they now have guarantees whether a
  path ends in a trailing path separator or not
* it may be safer for interaction with other library functions, which behave
  differently depending on a trailing path separator (like probably shelly)

Not limited to, but also in order to fix my remarks without breaking any
benefits, I did:
* rename the `Dir`/`File` types to `TPS`/`NoTPS`, so it's clear we are only
  giving information about trailing path separators and not actual file
  types we don't know about yet
* add a `MaybeTPS` type, which does not mess with trailing path separators
  and also gives no guarantees about them... then added `toNoTPS` and
  `toTPS` to allow type-safe conversion
* make some functions accept more general types, so we don't unnecessarily
  force paths with trailing separators for `(</>)` for example... instead
  these functions now examine the paths to still have correct behavior.
  This is really minor overhead. You might say now "but then I can append
  filepath to filepath". Well, as I said... we don't know whether it's a
  "filepath" at all.
* merge `filename` and `dirname` into `basename` and make `parent` be
  `dirname`, so the function names match the name of the POSIX ones,
  which do (almost) the same...
* fix a bug in `basename` (formerly `dirname`) which broke the type
  guarantees
* add a pattern synonym for easier pattern matching without exporting
  the internal Path constructor
2016-03-08 22:53:42 +01:00