module System.Directory.Paths (
Paths(..),
canonicalize,
absolutise,
relativise
) where
import Control.Lens
import System.Directory
import System.FilePath
class Paths a where
paths :: Traversal' a FilePath
instance Paths FilePath where
paths = id
canonicalize :: Paths a => a -> IO a
canonicalize = paths canonicalizePath
absolutise :: Paths a => FilePath -> a -> a
absolutise parent = over paths (parent </>)
relativise :: Paths a => FilePath -> a -> a
relativise parent = over paths (makeRelative parent)