Boost logo

Boost :

From: Jani Kajala (jani_at_[hidden])
Date: 2002-01-23 14:56:32


I think directory iteration is only one example of path manipulation. Imho more
could be done in this subject. What I'd like to have is a kind of abstract path
name class, which can be manipulated and then converted to system-dependent path
name when needed.

Here's example usage: First get path of current working directory, then combine
'..' to get path to upper level directory, then get path to subdirectory called
'fu' and then list max. 40 files from there. Two-argument constructor accepts
parent path and file name (and combines them to single abstract path).

path cwd = path::cwd();
path up = path( cwd, ".." );
path fu = path( up, "fu" );
assert( fu.exists() );
assert( fu.is_directory() );
std::string files[40];
int numfiles = fu.list( files, 40 );

Is there any interest in getting this kind of class to Boost? I have already
done this class before, but I'd like to hear some comments before submitting
anything. Other classes related to this could be for example "auto_cd" current
working directory changer which would change the cwd back at the dtor.

Some issues:
* Absolute path names containing drive letter are still not portable.
* Case-sensitiveness is still platform dependent

Regards,
Jani Kajala
http://www.helsinki.fi/~kajala


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