document an important property of relPathCwdToFile

This commit is contained in:
Joey Hess 2021-05-07 12:57:54 -04:00
parent 9e1a693f16
commit 73f330a62e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View 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