|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-09-01 13:20:29
At 01:53 PM 8/30/2004, Carlo Wood wrote:
>My idea on this was (and still is) that it is possible to convert
>a relative path to an absolute path (automatically) by adding an
>absolute path object reference to the relative path object.
Yes, as long as you know the absolute path reference. Is the absolute path
reference known for all operating systems? I'm not sure about that. For
example, there have been multi-rooted systems that didn't have a concept of
"current drive". How would that work?
>This should make sense in every application imho.
It makes sense for calling operating system file system functions. It may
make no sense at all if the use of the path is for reporting or other path
manipulations. The programs which process the Boost regression test bjam
output do a lot of that. Another example is reporting the path name from a
filesystem function which throws an exception.
>As a result, you can simply use absolute path types for all those
>functions that will pass that parameter to a system call.
Don't for get error reporting. While you certainly could report the
absolute path rather than the path as given, that would be a step backward
IMO.
>In the case of fs::exists, you would have only fs::exists(fs::native_path
>const&)
>and when calling that with a fs::relative_path - it would get expanded
>to the absolute path even before entering fs::exists (this expanding is
>necessary anyway - so why not before you do the actual call?). That way
>there is always only one function needed.
You lost me. I could see how what you are describing would work for exists(
fs::absolute_path const & ). It seems you are making some kind of
assumption regarding the relationship between native paths and absolute
paths. That is possible to do for Windows and POSIX, but not for operating
systems in general.
>Calling fs::exists("foo") would cause the constructor
fs::native_path(char
>const*) to be called, ...
What happens when the app wants "foo" treated as a generic rather than
native format? A better example might be "foo.bar" on an operating system
which uses "." as a directory separator in native formats.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk