LogUtilities 1.5.1
A small compiled library for C logging and configuration utility functions.
|
Functions for making it easier to create/access files. The LogUtilities
let the user read from config.yaml
so long as there is only a simple yaml syntax (i.e. no nested structures), and only handles explicitly-enumerated field name conventions.
More...
Data Structures | |
struct | HeaderData |
Structure to store header data. More... | |
struct | Config |
Structure to store configuration data parsed from yaml files. More... | |
Functions | |
void | containerFolder (char *filePathFS, int levelsUp) |
Retrieves the container folder of a file path up to a specified number of levels. | |
int | createFolderIfNotExists (const char *folderPath) |
Creates a folder at the specified path if it doesn't already exist. | |
void | replaceBackslashes (char *filePath, char *filePathFS) |
Replaces backslashes in a file path with forward slashes. | |
Functions for making it easier to create/access files. The LogUtilities
let the user read from config.yaml
so long as there is only a simple yaml syntax (i.e. no nested structures), and only handles explicitly-enumerated field name conventions.
For example, config.yaml
may take the following format (which includes the correct name syntax for valid yaml variables):
void containerFolder | ( | char * | filePathFS, |
int | levelsUp ) |
Retrieves the container folder of a file path up to a specified number of levels.
This function modifies the provided file path string to represent the container folder up to the specified number of levels. It replaces the characters beyond the container folder with a null terminator ('\0').
filePathFS | The file path for which the container folder is to be determined. This string should use forward slashes ('/') as path separators. |
levelsUp | The number of levels up from the file path to consider for the container folder. A value of 0 indicates the immediate parent folder, 1 indicates one level up, and so on. |
int createFolderIfNotExists | ( | const char * | folderPath | ) |
Creates a folder at the specified path if it doesn't already exist.
This function handles various error cases such as existing folders and non-existing parent directories.
folderPath | The path of the folder to create. |
void replaceBackslashes | ( | char * | filePath, |
char * | filePathFS ) |
Replaces backslashes in a file path with forward slashes.
This function ensures cross-platform compatibility in file paths.
filePath | The original file path. |
filePathFS | The file path with backslashes replaced by forward slashes. |