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
.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
)
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
)
66 for (int i
=0; i
< size(); i
++) {
67 String path
= (*this)[i
];
71 FILE *f
= fopen(path
, "r"); // ugh!