SysGetDirContents

Table of Contents

SysGetDirContents

Description

Read directory contents into a vector. Current contents of the vector will be cleared out.

Parameters

NameDirectionDescription
pathinPath of directory get content of.

Success

SysDirContents vector filled with directory contents data.

Failure

Returns empty vector on read error.

Usage example (Cross-references)

    #ifdef _WIN32
    // Windows-specific implementation using FindFirstFile/FindNextFile
    SysDirContents SysGetDirContents(const char *path) {
    if (!path) {
    LOG_FATAL("Invalid argument");
    #else
    // APPLE or Unix based system implementation using opendir/readdir
    SysDirContents SysGetDirContents(const char *path) {
    if (!path) {
    LOG_FATAL("invalid arguments.");
    StrMerge(&current_path, &dir_name);
    
    SysDirContents dir_contents = SysGetDirContents(dir_name.data);
    Scope(&dir_contents, VecDeinit, {
    VecForeach(&dir_contents, dir_entry) {

Share :

Related Posts

Vec

Vec Description Vector type for directory contents.

Read More

LOG_INFO

LOG_INFO Description Writes an informational log message. …[in] : Format string and arguments following printf-style syntax.

Read More

LOG_SYS_ERROR

LOG_SYS_ERROR Description Writes an error-level log message with errno explanation appended at the end of final string.

Read More