Path transformation

mal content artifact.one at googlemail.com
Sat Aug 19 12:27:51 UTC 2006


Hello.

Is there any code in the tree that does general path transformation
or 'optimisation'?

For example, this path corresponds to the current working directory:

  "dir1/dir2/dir3/../../../"

So I'd like to be able to pass that to a function and get the optimised
result of:

  "."

And so on for paths such as:

  "dir1/dir2/dir3/../../../../"

(Which obviously becomes "..").

  "dir1/dir2/dir3/../../../dir1"

(Optimised to "dir1").

  "dir1/dir2/dir3/../../../dir1/file.txt"

("dir1/file.txt")

It's giving me a real headache trying to work out the algorithm
to do this.

thanks,
MC


More information about the freebsd-hackers mailing list