Skip to content

DirCreateAll

Description

Recursive mkdir -p. Creates all missing path components. Existing components are treated as success (EEXIST is not an error). Trailing slashes are tolerated.

Parameters

Name Direction Description
path in Path of the directory tree. Prefer Str *; const char * accepted.

Success

Returns 1; the full path now exists as a directory.

Failure

Returns 0 on first un-recoverable error.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        // Make the dSYM bundle directory.
        DirCreateAll("/tmp/misra_macho_stripped.dSYM/Contents/Resources/DWARF");
        (void)dsym_dir;
        Zstr dsym_path = "/tmp/misra_macho_uuidmiss.dSYM/Contents/Resources/DWARF/misra_macho_uuidmiss";
    
        DirCreateAll("/tmp/misra_macho_uuidmiss.dSYM/Contents/Resources/DWARF");
    
        u8 bad_uuid[16];
    i8 dir_create_all(Zstr path) {
        if (!path) {
            LOG_FATAL("DirCreateAll: NULL path");
        }
        size n = ZstrLen(path);
        }
        if (n >= 4096) {
            LOG_ERROR("DirCreateAll(\"{}\"): path too long ({} bytes)", path, (u64)n);
            return 0;
        }
Last updated on