2 path.cc - manipulation of paths and filenames.
6 #include "flower-debug.hh"
13 @param path the original full filename
14 @return 4 components of the path. They can be empty
17 split_path(String path,
18 String &drive, String &dirs, String &filebase, String &extension)
20 // peel off components, one by one.
21 int di = path.index_i(':');
24 drive = path.left_str(di + 1);
25 path = path.right_str(path.len() - di -1);
30 di = path.index_last_i(PATHSEP);
33 dirs = path.left_str(di + 1);
34 path = path.right_str(path.len()-di -1);
39 di = path.index_last_i('.');
42 filebase = path.left_str(di);
43 extension =path.right_str(path.len()-di);
52 File_path::File_path(String pref)
60 It will search in the current dir, in the construction-arg, and
61 in any other added path, in this order.
64 File_path::find(String nm)const
67 fdebug << "looking for " << nm ;
68 for (int i=0; i < size(); i++) {
70 String path = (*this)[i];
73 fdebug << path << "? ";
74 FILE *f = fopen(path, "r"); // ugh!