DirRemoveAll
Description
Recursive rm -rf. Removes a directory tree (regular files, symlinks, subdirectories). If path doesn’t exist this is a no-op success. Follows the cross-platform i8 return convention.
Parameters
| Name | Direction | Description |
|---|---|---|
path |
in | Root of the tree. Prefer Str *; const char * accepted. |
Success
Returns 1; the path is gone (or never existed).
Failure
Returns 0 on first un-recoverable error.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
MachoCache.c:244:
FileRemove(bin_path);
FileRemove(dsym_path);
DirRemoveAll("/tmp/misra_macho_stripped.dSYM");
return ok;
}- In
MachoCache.c:278:
FileRemove(bin_path);
FileRemove(dsym_path);
DirRemoveAll("/tmp/misra_macho_uuidmiss.dSYM");
return ok;
}- In
Dir.c:593:
i8 dir_remove_all(Zstr path) {
if (!path) {
LOG_FATAL("DirRemoveAll: NULL path");
}
// Stat first: a missing path is a successful no-op (mirrors
- In
Dir.c:623:
StrAppendFmt(&child, trail_sep ? "{}{}" : "{}/{}", path, e->name.data);
if (e->type == SYS_DIR_ENTRY_TYPE_DIRECTORY) {
inner_ok = DirRemoveAll(&child);
} else {
inner_ok = FileRemove(&child);
Last updated on