makeRelativeDesc :: FilePath -- ^ path to a directory
                 -> FilePath -- ^ to be computed relatively to given directory
                 -> FilePath -- ^ resulting relative path
makeRelativeDesc dp fp = f dp fp []
    where f "" y l = joinPath $ l ++ [y]
          f x y l = let y' = makeRelative x y
                    in if equalFilePath y y'
                       then f (takeDirectory x) y $ ".." : l
                       else joinPath $ l ++ [y']

{- | filter a map according to a given list of keys (it dosen't hurt
   if a key is not present in the map) -}
makeRelativeDesc :: FilePath -- ^ path to a directory
                 -> FilePath -- ^ to be computed relatively to given directory
                 -> FilePath
makeRelativeDesc dp fp = f dp fp []
    where f "" y l = joinPath $ l ++ [y]
          f x y l = let y' = makeRelative x y
                    in if equalFilePath y y'
                       then f (takeDirectory x) y $ ".." : l
                       else joinPath $ l ++ [y']

{- | filter a map according to a given list of keys (it dosen't hurt
   if a key is not present in the map) -}
makeRelativeDesc dp fp = f dp fp []
    where f "" y l = joinPath $ l ++ [y]
          f x y l = let y' = makeRelative x y
                    in if equalFilePath y y'
                       then f (takeDirectory x) y $ ".." : l
                       else joinPath $ l ++ [y']

{- | filter a map according to a given list of keys (it dosen't hurt
   if a key is not present in the map) -}