FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_fs Namespace Reference

Enhanced filesystem utilities wrapping std::filesystem. More...

Typedefs

using path = fs::path
 
using perms = fs::perms
 
using copy_options = fs::copy_options
 
using perm_options = fs::perm_options
 

Functions

std::expected< fs::path, std::string > realpath (fs::path const &path_file_src)
 Resolves an input path using realpath(3)
 
Value< std::vector< fs::path > > regular_files (fs::path const &path_dir_src)
 List the files in a directory.
 
Value< fs::path > create_directories (fs::path const &p)
 Creates directories recursively.
 
template<typename... Args>
fs::path placeholders_replace (fs::path const &path, Args &&... args)
 Replace placeholders in a path by traversing components.
 

Detailed Description

Enhanced filesystem utilities wrapping std::filesystem.

This namespace extends std::filesystem with additional helper functions for common filesystem operations.

Typedef Documentation

◆ copy_options

using ns_fs::copy_options = fs::copy_options

Definition at line 36 of file filesystem.hpp.

◆ path

using ns_fs::path = fs::path

Definition at line 34 of file filesystem.hpp.

◆ perm_options

using ns_fs::perm_options = fs::perm_options

Definition at line 37 of file filesystem.hpp.

◆ perms

using ns_fs::perms = fs::perms

Definition at line 35 of file filesystem.hpp.

Function Documentation

◆ create_directories()

Value< fs::path > ns_fs::create_directories ( fs::path const & p)
inlinenodiscard

Creates directories recursively.

Parameters
pThe path of directories to create.
Returns
std::expected<void, std::string> The directory path if it exists or was just created , or error message.

Definition at line 76 of file filesystem.hpp.

Here is the caller graph for this function:

◆ placeholders_replace()

template<typename... Args>
fs::path ns_fs::placeholders_replace ( fs::path const & path,
Args &&... args )
inlinenodiscard

Replace placeholders in a path by traversing components.

This function iterates through each component of the path and replaces matching components with the provided arguments in order.

Template Parameters
ArgsThe types of the arguments to replace
Parameters
pathThe path with placeholder components
argsThe values to replace matching placeholders with
Returns
The path with placeholders replaced

Definition at line 101 of file filesystem.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ realpath()

std::expected< fs::path, std::string > ns_fs::realpath ( fs::path const & path_file_src)
inlinenodiscard

Resolves an input path using realpath(3)

Parameters
path_file_srcPath to resolve
Returns
std::expected<fs::path, std::string> The resolved path or error message

Definition at line 45 of file filesystem.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ regular_files()

Value< std::vector< fs::path > > ns_fs::regular_files ( fs::path const & path_dir_src)
inlinenodiscard

List the files in a directory.

Parameters
path_dir_srcPath to the directory to query for files
Returns
Value<std::vector<fs::path>> The list of files or the respective error
Examples
/flatimage/src/filesystems/layers.hpp.

Definition at line 61 of file filesystem.hpp.