[[a]] -> [a] +filepath

joinPath :: [FilePath] -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Join path elements back together. > Valid x => joinPath (splitPath x) == x > joinPath [] == "" > Posix: joinPath ["test","file","path"] == "test/file/path"
addTrailingPathSeparator :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Add a trailing file path separator if one is not already present. > hasTrailingPathSeparator (addTrailingPathSeparator x) > hasTrailingPathSeparator x ==> addTrailingPathSeparator x == x > Posix: addTrailingPathSeparator "test/rest" == "test/rest/"
dropDrive :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Delete the drive, if it exists. > dropDrive x == snd (splitDrive x)
dropExtension :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Remove last extension, and the "." preceding it. > dropExtension x == fst (splitExtension x)
dropExtensions :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Drop all extensions > not $ hasExtension (dropExtensions x)
dropFileName :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Drop the filename. > dropFileName x == fst (splitFileName x)
dropTrailingPathSeparator :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Remove any trailing path separators > dropTrailingPathSeparator "file/test/" == "file/test" > Posix: not (hasTrailingPathSeparator (dropTrailingPathSeparator x)) || isDrive x > Posix: dropTrailingPathSeparator "/" == "/" > Windows: dropTrailingPathSeparator "\\" == "\\"
makeValid :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Take a FilePath and make it valid; does not change already valid FilePaths. > isValid (makeValid x) > isValid x ==> makeValid x == x > makeValid "" == "_" > Windows: makeValid "c:\\test:of_test" == "c:\\test_of_test" > Windows: makeValid "test*" == "test_" > Windows: makeValid "c:\\test\\nul" == "c:\\test\\nul_" > Windows: makeValid "c:\\test\\prn.txt" == "c:\\test\\prn_.txt" > Windows: makeValid "c:\\test/prn.txt" == "c:\\test/prn_.txt" > Windows: makeValid "c:\\nul\\file" == "c:\\nul_\\file"
normalise :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Normalise a file * // outside of the drive can be made blank * / -> pathSeparator * ./ -> "" > Posix: normalise "/file/\\test////" == "/file/\\test/" > Posix: normalise "/file/./test" == "/file/test" > Posix: normalise "/test/file/../bob/fred/" == "/test/file/../bob/fred/" > Posix: normalise "../bob/fred/" == "../bob/fred/" > Posix: normalise "./bob/fred/" == "bob/fred/" > Windows: normalise "c:\\file/bob\\" == "C:\\file\\bob\\" > Windows: normalise "c:\\" == "C:\\" > Windows: normalise "\\\\server\\test" == "\\\\server\\test" > Windows: normalise "c:/file" == "C:\\file" > normalise "." == "." > Posix: normalise "./" == "./" > Posix: normalise "./." == "./" > Posix: normalise "/" == "/" > Posix: normalise "bob/fred/." == "bob/fred/"
takeDirectory :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the directory name, move up one level. > takeDirectory x `isPrefixOf` x || takeDirectory x == "." > takeDirectory "foo" == "." > takeDirectory "/foo/bar/baz" == "/foo/bar" > takeDirectory "/foo/bar/baz/" == "/foo/bar/baz" > takeDirectory "foo/bar/baz" == "foo/bar" > Windows: takeDirectory "foo\\bar" == "foo" > Windows: takeDirectory "foo\\bar\\\\" == "foo\\bar" > Windows: takeDirectory "C:\\" == "C:\\"
takeDrive :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the drive from a filepath. > takeDrive x == fst (splitDrive x)
takeFileName :: FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get the file name. > takeFileName "test/" == "" > takeFileName x `isSuffixOf` x > takeFileName x == snd (splitFileName x) > Valid x => takeFileName (replaceFileName x "fred") == "fred" > Valid x => takeFileName (x </> "fred") == "fred" > Valid x => isRelative (takeFileName x)
takeBaseName :: FilePath -> String
filepath System.FilePath.Windows, filepath System.FilePath.Posix
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"
takeExtension :: FilePath -> String
filepath System.FilePath.Windows, filepath System.FilePath.Posix
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"
takeExtensions :: FilePath -> String
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Get all extensions > takeExtensions "file.tar.gz" == ".tar.gz"
(</>) :: FilePath -> FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
A nice alias for combine.
combine :: FilePath -> FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Combine two paths, if the second path isAbsolute, then it returns the second. > Valid x => combine (takeDirectory x) (takeFileName x) `equalFilePath` x > Posix: combine "/" "test" == "/test" > Posix: combine "home" "bob" == "home/bob" > Windows: combine "home" "bob" == "home\\bob" > Windows: combine "home" "/bob" == "/bob"
joinDrive :: FilePath -> FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Join a drive and the rest of the path. > uncurry joinDrive (splitDrive x) == x > Windows: joinDrive "C:" "foo" == "C:foo" > Windows: joinDrive "C:\\" "bar" == "C:\\bar" > Windows: joinDrive "\\\\share" "foo" == "\\\\share\\foo" > Windows: joinDrive "/:" "foo" == "/:\\foo"
makeRelative :: FilePath -> FilePath -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Contract a filename, based on a relative path. There is no corresponding makeAbsolute function, instead use System.Directory.canonicalizePath which has the same effect. > Valid y => equalFilePath x y || (isRelative x && makeRelative y x == x) || equalFilePath (y </> makeRelative y x) x > makeRelative x x == "." > null y || equalFilePath (makeRelative x (x </> y)) y || null (takeFileName x) > Windows: makeRelative "C:\\Home" "c:\\home\\bob" == "bob" > Windows: makeRelative "C:\\Home" "c:/home/bob" == "bob" > Windows: makeRelative "C:\\Home" "D:\\Home\\Bob" == "D:\\Home\\Bob" > Windows: makeRelative "C:\\Home" "C:Home\\Bob" == "C:Home\\Bob" > Windows: makeRelative "/Home" "/home/bob" == "bob" > Posix: makeRelative "/Home" "/home/bob" == "/home/bob" > Posix: makeRelative "/home/" "/home/bob/foo/bar" == "bob/foo/bar" > Posix: makeRelative "/fred" "bob" == "bob" > Posix: makeRelative "/file/test" "/file/test/fred" == "fred" > Posix: makeRelative "/file/test" "/file/test/fred/" == "fred/" > Posix: makeRelative "some/path" "some/path/a/b/c" == "a/b/c"
(<.>) :: FilePath -> String -> FilePath
filepath System.FilePath.Windows, filepath System.FilePath.Posix
Alias to addExtension, for people who like that sort of thing.

Show more results