Path transformation
Mike Meyer
mwm-keyword-freebsdhackers2.e313df at mired.org
Sat Aug 19 16:07:32 UTC 2006
In <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec at mail.gmail.com>, mal content <artifact.one at googlemail.com> typed:
> 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:
>
> "."
>
> It's giving me a real headache trying to work out the algorithm
> to do this.
If you just want the algorithm, the python distribution has one in
posixpath.py: the normpath function. Heed the warning about symbolic
links.
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
More information about the freebsd-hackers
mailing list