document an important property of relPathCwdToFile
authorJoey Hess <joeyh@joeyh.name>
Fri, 7 May 2021 16:57:54 +0000 (12:57 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 7 May 2021 16:57:54 +0000 (12:57 -0400)
Utility/Path/AbsRel.hs

index 0026bd6a196dd822693d02d6561cc6f7e112062f..951d0aa1b8f050d50dca6d907e4d0fb2d7d2bd28 100644 (file)
@@ -64,11 +64,12 @@ absPath file
 #endif
                return $ absPathFrom cwd file
 
-{- Constructs a relative path from the CWD to a file.
+{- Constructs the minimal relative path from the CWD to a file.
  -
  - For example, assuming CWD is /tmp/foo/bar:
  -    relPathCwdToFile "/tmp/foo" == ".."
  -    relPathCwdToFile "/tmp/foo/bar" == "" 
+ -    relPathCwdToFile "../bar/baz" == "baz"
  -}
 relPathCwdToFile :: RawFilePath -> IO RawFilePath
 relPathCwdToFile f = do
@@ -79,7 +80,7 @@ relPathCwdToFile f = do
 #endif
        relPathDirToFile c f
 
-{- Constructs a relative path from a directory to a file. -}
+{- Constructs a minimal relative path from a directory to a file. -}
 relPathDirToFile :: RawFilePath -> RawFilePath -> IO RawFilePath
 relPathDirToFile from to = relPathDirToFileAbs <$> absPath from <*> absPath to