Date: Sat, 19 Aug 2006 12:07:22 -0400 From: Mike Meyer <mwm-keyword-freebsdhackers2.e313df@mired.org> To: "mal content" <artifact.one@googlemail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Path transformation Message-ID: <17639.14138.471768.271459@bhuda.mired.org> In-Reply-To: <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com> References: <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com>, mal content <artifact.one@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@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17639.14138.471768.271459>