curry-base-0.2.5: Functions for manipulating Curry programs

Curry.Files.PathUtils

Synopsis

Documentation

takeBaseName :: FilePath -> String

Get the base name, without an extension or path.

takeBaseName "file/test.txt" == "test" takeBaseName "dave.ext" == "dave" takeBaseName "" == "" takeBaseName "test" == "test" takeBaseName (addTrailingPathSeparator x) == "" takeBaseName "file/file.tar.gz" == "file.tar"

dropExtension :: FilePath -> FilePath

Remove last extension, and the "." preceding it.

dropExtension x == fst (splitExtension x)

takeExtension :: FilePath -> String

Get the extension of a file, returns "" for no extension, .ext otherwise.

takeExtension x == snd (splitExtension x) Valid x => takeExtension (addExtension x "ext") == ".ext" Valid x => takeExtension (replaceExtension x "ext") == ".ext"