Subject: Re: [boost] FW: [filesystem] : basic_path : Feature request
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-02-07 13:38:21
On Sat, Feb 7, 2009 at 05:55, Rob <robrimmer_at_[hidden]> wrote:
> My code above to remove '.' was part of a 'canonicalize' function which
> removed both '.' and '..' where possible. (This may be a candidate for a
> convenience function within the library?)
In fact, boost::filesystem::canonize already exists, albeit
deprecated. It doesn't appear to do anything, though, which confuses
me. boost::filesystem::normalize is too much, as it does the foo/..
=> . reduction, which is unsafe.
I would like to see similar things return, though. I'd advocate a
clean() member function that does the foo/./bar => foo/bar reduction
and ensures that all relative paths start with ./ or ../, and a
non-member expand that removes all symlinks and ..s (which would
require that it have a root).