Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-11-24 14:15:24


I have started using the boost filesystem library in our application
codes and encountered a problem that could be solved by adding either
of the three functions

bool is_relative() const;
bool is_absolute() const;
void make_absolute();

to the path class.

Let me motivate this by an example: if the user specifies a relative
path the file system library automatically prepends it with the result
of a call to initial_directory(). In parallel programs however, even
when the file system is shared, the result of a call to
initial_directory() need not be the same on all nodes of a parallel
machine. Thus I need to convert all relative paths to absolute ones
before sending the path to another node.

At the moment I check for this by asking whether the first character is
a '/', but this works only under Unix variants but not under Windows.
Although we do not run our codes under Windows, other users of our
libraries might and I would thus like to have a portable method, which
could be implemented through either of the three functions mentioned
above. Neither of the functions should be more than a single-line
function.

What do you think about that?

Best regards,

Matthias


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk