Skip to content
SysDirContents

SysDirContents

SysDirContents

Description

Vector type for directory contents.

Usage example (Cross-references)

Usage examples (Cross-references)
    #ifdef _WIN32
    // Windows-specific implementation using FindFirstFile/FindNextFile
    SysDirContents SysGetDirContents(const char *path) {
        if (!path) {
            LOG_FATAL("Invalid argument");
        }
    
        SysDirContents dc = VecInit();
    
        // Construct the search path with a wildcard
    
        if (hFind == INVALID_HANDLE_VALUE) {
            return (SysDirContents) {0};
        }
    #else
    // APPLE or Unix based system implementation using opendir/readdir
    SysDirContents SysGetDirContents(const char *path) {
        if (!path) {
            LOG_FATAL("invalid arguments.");
        }
    
        SysDirContents dc = VecInit();
    
        DIR *dir = opendir(path);
        if (NULL == dir) {
            LOG_SYS_ERROR("opendir(\"{}\") failed", path);
            return (SysDirContents) {0};
        }
                        StrMerge(&current_path, &dir_name);
    
                        SysDirContents dir_contents = SysGetDirContents(dir_name.data);
                        Scope(&dir_contents, VecDeinit, {
                            VecForeach(&dir_contents, dir_entry) {
    /// TAGS: System, FileSystem, Directory
    ///
    SysDirContents SysGetDirContents(const char *path);
    
    ///
Last updated on