vcs-ignore-0.0.2.0: Library for handling files ignored by VCS systems.
Copyright(c) 2020-2022 Vaclav Svejcar
LicenseBSD-3-Clause
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.VCS.Ignore.FileSystem

Description

This module contains mainly helper functions, that are internally used by this library.

Synopsis

Documentation

findPaths Source #

Arguments

:: MonadIO m 
=> FilePath

path to traverse

-> (FilePath -> m Bool)

predicate to match filename

-> m [FilePath]

list of found paths

Recursively finds paths on given path whose filename matches the predicate.

listPaths Source #

Arguments

:: MonadIO m 
=> FilePath

path to traverse

-> m [FilePath]

list of found paths

Recursively finds all paths on given path. If file reference is passed instead of directory, such path is returned.

walkPaths Source #

Arguments

:: MonadIO m 
=> FilePath

path to traverse

-> (FilePath -> m a)

function to process path

-> m [a]

result of traversed & processed paths

Recursively walks the given path and performs selected action for each found file. Output of this function is:

  • If the given path is file, only this single path is processed and returned.
  • If the given path is directory, all subdirectories and files are recursively processed and returned.
  • If the given path doesn't exist, empy list will be returned.

toPosixPath Source #

Arguments

:: FilePath

input filepath to convert

-> FilePath

output filepath

If the given path contains backward slashes (Windows style), converts them into forward ones (Unix style).

>>> toPosixPath "foo\\bar\\x.txt"
"foo/bar/x.txt"
>>> toPosixPath "foo/bar/x.txt"
"foo/bar/x.txt"