Skip to content

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 *; Zstr 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)
    i8 dir_remove_all(Zstr path) {
        if (!path) {
            LOG_FATAL("DirRemoveAll: NULL path");
        }
        // Stat first: a missing path is a successful no-op (mirrors
                StrAppendFmt(&child, trail_sep ? "{}{}" : "{}/{}", path, entry_nm);
                if (e->type == DIR_ENTRY_TYPE_DIRECTORY) {
                    inner_ok = DirRemoveAll(&child);
                } else {
                    inner_ok = FileRemove(&child);
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_macho_stripped.dSYM");
        return ok;
    }
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_macho_uuidmiss.dSYM");
        return ok;
    }
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_mc_dsym.dSYM");
        DebugAllocatorDeinit(&dbg);
        return ok;
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_mc_uuidmiss.dSYM");
        DebugAllocatorDeinit(&dbg);
        return ok;
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_mc_dwarf.dSYM");
        DebugAllocatorDeinit(&dbg);
        return ok;
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_bl_dwarf.dSYM");
        DefaultAllocatorDeinit(&alloc);
        return ok;
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_bl_dwarf2.dSYM");
        DefaultAllocatorDeinit(&alloc);
        return ok;
        FileRemove(bin_path);
        FileRemove(dsym_path);
        DirRemoveAll("/tmp/misra_bl_dwarf3.dSYM");
        DebugAllocatorDeinit(&dbg);
        return ok;
Last updated on