filepath: Library for manipulating FilePaths in a cross platform way.

[ bsd3, library, system ] [ Propose Tags ]

This package provides functionality for manipulating FilePath values, and is shipped with both GHC and the Haskell Platform. It provides three modules:

  • System.FilePath.Posix manipulates POSIX/Linux style FilePath values (with / as the path separator).

  • System.FilePath.Windows manipulates Windows style FilePath values (with either \ or / as the path separator, and deals with drives).

  • System.FilePath is an alias for the module appropriate to your platform.

All three modules provide the same API, and the same documentation (calling out differences in the different variants).


[Skip to Readme]

Downloads

Versions [RSS] 1.0, 1.1.0.0, 1.1.0.1, 1.1.0.2, 1.1.0.3, 1.1.0.4, 1.2.0.0, 1.2.0.1, 1.3.0.0, 1.3.0.1, 1.3.0.2, 1.4.0.0, 1.4.1.0, 1.4.1.1, 1.4.1.2, 1.4.2, 1.4.2.1, 1.4.2.2, 1.4.100.0, 1.4.100.1, 1.4.100.2, 1.4.100.3, 1.4.100.4, 1.4.101.0, 1.4.200.0, 1.4.200.1, 1.4.300.1, 1.5.0.0, 1.5.2.0 (info)
Change log changelog.md
Dependencies base (>=4.9 && <4.17) [details]
License BSD-3-Clause
Copyright Neil Mitchell 2005-2020
Author Neil Mitchell <ndmitchell@gmail.com>
Maintainer Julian Ospald <hasufell@posteo.de>
Category System
Home page https://github.com/haskell/filepath#readme
Bug tracker https://github.com/haskell/filepath/issues
Source repo head: git clone https://github.com/haskell/filepath.git
Uploaded by maerwald at 2021-12-07T16:17:29Z
Distributions Arch:1.4.2.2, Fedora:1.4.2.2
Reverse Dependencies 1730 direct, 12909 indirect [details]
Downloads 60939 total (654 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-12-07 [all 1 reports]

Readme for filepath-1.4.2.2

[back to package description]

FilePath Hackage version

The filepath package provides functionality for manipulating FilePath values, and is shipped with GHC. It provides three modules:

  • System.FilePath.Posix manipulates POSIX/Linux style FilePath values (with / as the path separator).
  • System.FilePath.Windows manipulates Windows style FilePath values (with either \ or / as the path separator, and deals with drives).
  • System.FilePath is an alias for the module appropriate to your platform.

All three modules provide the same API, and the same documentation (calling out differences in the different variants).

What is a FilePath?

In Haskell, the definition is type FilePath = String as of now. A Haskell String is a list of Unicode code points.

On unix, filenames don't have a predefined encoding as per the POSIX specification and are passed as char[] to syscalls.

On windows (at least the API used by Win32) filepaths are UTF-16 strings.

This means that Haskell filepaths have to be converted to C-strings on unix (utilizing the current filesystem encoding) and to UTF-16 strings on windows.

Further, this is a low-level library and it makes no attempt at providing a more type safe variant for filepaths (e.g. by distinguishing between absolute and relative paths) and ensures no invariants (such as filepath validity).

For such libraries, check out the following: