Unixutils-1.17: A crude interface between Haskell and Unix-like operating systems

System.Unix.FilePath

Contents

Description

The function splitFileName is taken from missingh, at the moment missingh will not build under sid.

Synopsis

Documentation

realpath :: FilePath -> IO FilePathSource

resolve all references to ., .., extra slashes, and symlinks

From MissingH

splitFileName :: FilePath -> (String, String)Source

Split the path into directory and file name

Examples:

[Posix]

 splitFileName "/"            == ("/",    ".")
 splitFileName "/foo/bar.ext" == ("/foo", "bar.ext")
 splitFileName "bar.ext"      == (".",    "bar.ext")
 splitFileName "/foo/."       == ("/foo", ".")
 splitFileName "/foo/.."      == ("/foo", "..")

[Windows]

 splitFileName "\\"               == ("\\",      "")
 splitFileName "c:\\foo\\bar.ext" == ("c:\\foo", "bar.ext")
 splitFileName "bar.ext"          == (".",       "bar.ext")
 splitFileName "c:\\foo\\."       == ("c:\\foo", ".")
 splitFileName "c:\\foo\\.."      == ("c:\\foo", "..")

The first case in the Windows examples returns an empty file name. This is a special case because the "\\" path doesn't refer to an object (file or directory) which resides within a directory.