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

Function ddio_GetParentPath

ddio/winfile.cpp:495–512  ·  view source on GitHub ↗

given a path (with no filename), it will return the parent path srcPath is the source given path dest is where the parent path will be placed returns true on success dest should be at least _MAX_PATH in length

Source from the content-addressed store, hash-verified

493// returns true on success
494// dest should be at least _MAX_PATH in length
495bool ddio_GetParentPath(char *dest, const char *srcPath) {
496 assert(srcPath);
497 assert(dest);
498
499#define PARENT_DELIM ".."
500 int spath_len = strlen(srcPath);
501 char *temp;
502
503 temp = (char *)mem_malloc(spath_len + strlen(PARENT_DELIM) + 3);
504 if (!temp) {
505 return false;
506 }
507
508 ddio_MakePath(temp, srcPath, PARENT_DELIM, NULL);
509 ddio_CleanPath(dest, temp);
510 mem_free(temp);
511 return true;
512}
513
514// Finds a full path from a relative path
515// Parameters: full_path - filled in with the fully-specified path. Buffer must be at least _MAX_PATH bytes long

Callers 1

DoPathFileDialogFunction · 0.50

Calls 2

ddio_MakePathFunction · 0.70
ddio_CleanPathFunction · 0.70

Tested by

no test coverage detected