2 path.cc - manipulation of paths and filenames.
12 @param path the original full filename
13 @return 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.index_i(':');
23 drive = path.left_str(di + 1);
24 path = path.right_str(path.len() - di -1);
29 di = path.index_last_i(PATHSEP);
32 dirs = path.left_str(di + 1);
33 path = path.right_str(path.len()-di -1);
38 di = path.index_last_i('.');
41 filebase = path.left_str(di);
42 extension =path.right_str(path.len()-di);
51 File_path::File_path(String pref)
59 It will search in the current dir, in the construction-arg, and
60 in any other added path, in this order.
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!