2 path.cc - manipulation of paths and filenames.
12 INPUT: path the original full filename
13 OUTPUT: 4 components of the path. They can be empty
16 split_path(String path,
17 String &drive, String &dirs, String &filebase, String &extension)
19 // peel off components, one by one.
20 int di = path.pos(':');
23 drive = path.left(di);
24 path = path.right(path.len() - di);
29 di = path.lastPos(PATHSEP);
33 path = path.right(path.len()-di);
38 di = path.lastPos('.');
41 di --; // don't forget '.'
42 filebase = path.left(di);
43 extension =path.right(path.len()-di);
52 File_path::File_path(String pref)
61 It will search in the current dir, in the construction-arg, and
62 in any other added path, in this order.
65 File_path::find(String nm)
67 for (int i=0; i < size(); i++) {
68 String path = (*this)[i];
72 FILE *f = fopen(path, "r"); // ugh!