Skip to content

DirContents

Description

Vector type for directory contents.

Usage example (Cross-references)

Usage examples (Cross-references)
    /// TAGS: System, FileSystem, Directory
    ///
    DirContents dir_get_contents(Zstr path, Allocator *alloc);
    #define DirGetContents(...) OVERLOAD(DirGetContents, __VA_ARGS__)
    #define DirGetContents_1(path)                                                                                         \
    #if PLATFORM_WINDOWS
    // Windows-specific implementation using FindFirstFile/FindNextFile
    DirContents dir_get_contents(Zstr path, Allocator *alloc) {
        if (!path || !alloc) {
            LOG_FATAL("Invalid argument");
        }
    
        DirContents dc = (DirContents)VecInit(alloc);
    
        // Construct the search path: "<path>\*". Built with the in-tree
    }
    
    DirContents dir_get_contents(Zstr path, Allocator *alloc) {
        if (!path || !alloc) {
            LOG_FATAL("Invalid arguments");
        }
    
        DirContents dc = (DirContents)VecInit(alloc);
    
        // O_RDONLY | O_DIRECTORY | O_CLOEXEC. Values match between Linux
        // by both typed and erased callers) -- legitimate erasure boundary;
        // pass at the call site, no intermediate variable.
        DirContents dc = dir_get_contents(path, ALLOCATOR_OF(&ha));
    
        bool ok        = true;
Last updated on