2 path.cc - manipulation of paths and filenames.
13 split_path(String path,
14 String &drive, String &dirs, String &filebase, String &extension)
16 // peel off components, one by one.
17 int di = path.pos(':');
20 drive = path.left(di);
21 path = path.right(path.len() - di);
26 di = path.lastPos(PATHSEP);
30 path = path.right(path.len()-di);
35 di = path.lastPos('.');
38 di --; // don't forget '.'
39 filebase = path.left(di);
40 extension =path.right(path.len()-di);
49 INPUT: path the original full filename
50 OUTPUT: 4 components of the path. They can be empty
54 File_path::File_path(String pref)
63 File_path::find(String nm)
65 for (int i=0; i < size(); i++) {
66 String path = (*this)[i];
70 FILE *f = fopen(path, "r"); // ugh!
79 It will search in the current dir, in the construction-arg, and
80 in any other added path, in this order.