
On Wed, Aug 18, 2004 at 08:32:32AM -0400, David Abrahams wrote:
Yeah. But IMO on cygwin boost::filesystem should handle both formats.
I agree. I am currently working around the problem by implemeting support for this in my own code (I don't want my code to break when boost suddenly changes its default - or when someone ELSE links my software with a boost that has been compiled with BOOST_POSIX :/). My approach is this: When "/foo/bar" (which has a root_directory) is not complete (according to boost::filesystem::is_complete) then apparently we have a multi-root system and I prepend the cygwin installation path before it (only on cygwin that is; actually I prepend something that I called a 'root_base', which is empty on GNU/Linux, and "C:/cygwin" (for example) on cygwin. On windows this would be the current drive name ("C:" or "D:" etc)). If it *is* complete, then it is not touched because then we apparently have a single-root system. We observe that this correction is only needed when !fs::is_complete(ph) && ph.has_root_directory() Because, when it is complete, then the path already works - and when it isn't and there is also no root directory - then the path is relative and gets expanded correctly (namely, current_path() *does* include the 'root_base' on cygwin with BOOST_WINDOWS). Having defined "root_base" above - then only thing that is needed is to add this test for the parameters of certain operations, like 'exists'. Thus, the boost::filesystem::exists function then would be changed to prepend the root_base when the path pass to it is not complete but _does_ have a root_directory. What do you think? -- Carlo Wood <carlo@alinoe.com>