pass in a pathname (could be from ddio_SplitPath), root_path will have the drive name.
| 323 | |
| 324 | // pass in a pathname (could be from ddio_SplitPath), root_path will have the drive name. |
| 325 | void ddio_GetRootFromPath(const char *srcPath, char *root_path) { |
| 326 | assert(root_path); |
| 327 | assert(srcPath); |
| 328 | |
| 329 | // the first char should be drive letter, second char should be a : |
| 330 | if ((isalpha(srcPath[0])) && (srcPath[1] == ':')) { |
| 331 | // everything is ok |
| 332 | strncpy(root_path, srcPath, 2); |
| 333 | root_path[2] = '\0'; |
| 334 | } else { |
| 335 | // invalid path (no root) |
| 336 | root_path[0] = '\0'; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | // retrieve root names, free up roots array (allocated with malloc) after use |
| 341 | int ddio_GetFileSysRoots(char **roots, int max_roots) { |