-/**
- @param path the original full filename
- @return 4 components of the path. They can be empty
-*/
-void
-split_path (String path,
- String &drive, String &dirs, String &filebase, String &extension)
-{
- // peel off components, one by one.
- int di = path.index_i (':');
- if (di >= 0)
- {
- drive = path.left_str (di + 1);
- path = path.right_str (path.length_i () - di -1);
- }
- else
- drive = "";
-
- di = path.index_last_i (DIRSEP);
- if (di >=0)
- {
- dirs = path.left_str (di + 1);
- path = path.right_str (path.length_i ()-di -1);
- }
- else
- dirs = "";
-
- di = path.index_last_i ('.');
- if (di >= 0)
- {
- filebase = path.left_str (di);
- extension =path.right_str (path.length_i ()-di);
- }
- else
- {
- extension = "";
- filebase = path;
- }
-}
-