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
| 493 | // returns true on success |
| 494 | // dest should be at least _MAX_PATH in length |
| 495 | bool 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 |
no test coverage detected