Search FilePath API


FilePath is a Haskell library for manipulating FilePath values in a cross-platform way on both Windows and Unix/Linux. To give a simple example:

import System.FilePath

main = do
    putStrLn $ takeFileName "/usr/bin/readme.txt"  -- prints "readme.txt"
    putStrLn $ "/usr/bin" </> "readme" <.> "txt"   -- prints "/usr/bin/readme.txt"

This library provides three modules. To use filepaths matching your platform, import System.FilePath. To always use a particular platforms filepaths, either import System.FilePath.Windows or System.FilePath.Posix,

The FilePath library was originally written for Yhc, and then refined through extensive discussion on the Haskell mailing lists. The library is now part of the core Haskell libraries, and since GHC 6.6.1 has been shipped with all major compilers. While I am the original author, changes are now made through the library submissions process.


Tags: haskell library released