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
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
- [boost] Re: relative/absolute paths in filesystem library Matthias Troyer
- [boost] Re: relative/absolute paths in filesystem lib... Beman Dawes
- Re: [boost] Re: relative/absolute paths in filesy... Justus Schwartz
- Re: [boost] Re: relative/absolute paths in fi... Beman Dawes