|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-09-18 09:51:57
At 04:07 AM 9/18/2002, Vladimir Prus wrote:
>Speaking terms of posix paths, I want
>
> join("/home/ghost", "a/b") = "/home/ghost/a/b"
> join("/home/ghost", "/a/b") = "/a/b"
Sounds like you want the [make_]absolute() function we have been discussing
in another thread. The order of the arguments is reversed, but other than
that the functionality seems the same.
> int main()
> {
> fs::path p1("/home/ghost", fs::system_specific),
> p2("/a/b/c", fs::system_specific),
p3("a/b/c");
cout << absolute(p2, p1).file_path() << "\n";
cout << absolute(p3, p1).file_path() << "\n";
> cout << (p1 << p2).file_path() << "\n";
> }
The output should be:
/a/b/c
/home/ghost/a/b/c
/home/ghost/a/b/c
Note that last one demonstrates a deliberate feature rather than a bug. To
make that clearer, the following has been added to the append docs:
Rationale: It is not considered an error for rhs to include a
system-specific-root because it might relative, and thus valid.
For example, on Windows, the follow must succeed:
path p( "c:", system_specific );
p <<= path( "/foo", system_specific );
assert( p.generic_path() == "c:/foo" );
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk