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 *; Zstr 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)
    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;
        }
    
        // 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];
        Zstr bin_path  = "/tmp/misra_mc_dsym";
        Zstr dsym_path = "/tmp/misra_mc_dsym.dSYM/Contents/Resources/DWARF/misra_mc_dsym";
        DirCreateAll("/tmp/misra_mc_dsym.dSYM/Contents/Resources/DWARF");
    
        u64       bin_size  = mc_build_macho_image(mc_bin_buf, mc_kUuid, NULL, 0);
        Zstr bin_path  = "/tmp/misra_mc_uuidmiss";
        Zstr dsym_path = "/tmp/misra_mc_uuidmiss.dSYM/Contents/Resources/DWARF/misra_mc_uuidmiss";
        DirCreateAll("/tmp/misra_mc_uuidmiss.dSYM/Contents/Resources/DWARF");
    
        u8 bad_uuid[16];
        Zstr bin_path  = "/tmp/misra_mc_dwarf";
        Zstr dsym_path = "/tmp/misra_mc_dwarf.dSYM/Contents/Resources/DWARF/misra_mc_dwarf";
        DirCreateAll("/tmp/misra_mc_dwarf.dSYM/Contents/Resources/DWARF");
    
        // Name length is chosen so the resulting .debug_info size is NOT 42
        Zstr bin_path  = "/tmp/misra_bl_dwarf";
        Zstr dsym_path = "/tmp/misra_bl_dwarf.dSYM/Contents/Resources/DWARF/misra_bl_dwarf";
        DirCreateAll("/tmp/misra_bl_dwarf.dSYM/Contents/Resources/DWARF");
    
        Zstr      fn_name   = "dwarf_widget_function_with_long_name";
        Zstr bin_path  = "/tmp/misra_bl_dwarf2";
        Zstr dsym_path = "/tmp/misra_bl_dwarf2.dSYM/Contents/Resources/DWARF/misra_bl_dwarf2";
        DirCreateAll("/tmp/misra_bl_dwarf2.dSYM/Contents/Resources/DWARF");
    
        Zstr      fn_name   = "second_pass_dwarf_routine";
        Zstr bin_path  = "/tmp/misra_bl_dwarf3";
        Zstr dsym_path = "/tmp/misra_bl_dwarf3.dSYM/Contents/Resources/DWARF/misra_bl_dwarf3";
        DirCreateAll("/tmp/misra_bl_dwarf3.dSYM/Contents/Resources/DWARF");
    
        Zstr      fn_name   = "dwarf_leakcheck_routine_name";
Last updated on