Why is relpath("x","y") == "../x"?

evanfields
Thu, 21 Dec 2023 22:48:18 +0000
General Usage

julia> relpath("tatooine", "naboo")
"../tatooine"

The docs say
relpath(path::AbstractString, startpath::AbstractString = ".") -> AbstractString

Return a relative filepath to path either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the existence or nature of path or startpath.

But it seems like as a purely path operation, the answer should be “you can’t get there from here”? relpath("tatooine", "naboo") == "../tatooine" seems to imply that tatooine and naboo are adjacent directories, but…that might not be true?

6 posts - 5 participants