MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ddio_GetRootFromPath

Function ddio_GetRootFromPath

ddio/winfile.cpp:325–338  ·  view source on GitHub ↗

pass in a pathname (could be from ddio_SplitPath), root_path will have the drive name.

Source from the content-addressed store, hash-verified

323
324// pass in a pathname (could be from ddio_SplitPath), root_path will have the drive name.
325void 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
341int ddio_GetFileSysRoots(char **roots, int max_roots) {

Callers 1

UpdateFileListFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected