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

SysGetCurrentProcessId

SysGetCurrentProcessId Description Platform independent method to get current process Id.

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

LOG_SYS_FATAL

LOG_SYS_FATAL Description Writes a fatal log message and aborts the program, with errno explanation appended at the end of final string.

Read More