Loading...
Searching...
No Matches
by::fsystem Class Reference

Cross-platform filesystem utilities for recursive file traversal. More...

#include <fsystem.hpp>

Static Public Member Functions

static iterator find (const std::string &path)
 Creates iterator for recursive filesystem traversal.
 
static std::string getCurrentDir ()
 
static const std::string & getDelimiter ()
 

Detailed Description

Cross-platform filesystem utilities for recursive file traversal.

A simple class for recursively traversing files in a specified folder. Provides platform-independent API that works on both Windows and POSIX-compliant operating systems. Core functionality is provided through the iterator class.

Usage

Basic usage example:

auto e = fsystem::find("../your/path");
while(e.next()) { // Returns false when all files are traversed
const std::string& path = *e; // Path of the found file
if(*e == "../your/path/child/helloWorld.cpp") // Always uses relative paths
doSomething(e->getDir()); // Returns the folder path of the found file
}
static iterator find(const std::string &path)
Creates iterator for recursive filesystem traversal.
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34
Remarks
Always iterates files only Empty folders are skipped during iteration.

supports partial glob patterns

You can use aterisk (*) and question mark (?) wildcards in the pattern.

auto e = fsystem::find("*.cpp"); // the only difference is here
while(e.next()) {
const std::string& path = *e;
if(*e == "your/path/child/helloWorld.cpp")
doSomething(e->getDir());
}

Member Function Documentation

◆ find()

static iterator by::fsystem::find ( const std::string & path)
static

Creates iterator for recursive filesystem traversal.

Returns
iterator positioned at first file, or at end if path invalid
Note
Automatically traverses subdirectories recursively, yielding only files

The documentation for this class was generated from the following file: