refactoredCPPNeuronMesher
|
Implementation of utility functions for file system operations. More...
Functions | |
std::string | getExecutableDir () |
Gets the directory containing the currently running executable. More... | |
void | checkFolder (std::string &folderPath) |
Checks if a folder exists and creates it if it doesn't. More... | |
void | deleteFolder (const std::string &path) |
Recursively deletes a directory and all its contents. More... | |
std::vector< std::string > | listFilesInDirectory (const std::string &path) |
Lists all regular files in the specified directory. More... | |
Implementation of utility functions for file system operations.
This file contains general-purpose utility functions for file system operations used throughout the CPPNeuronMesher project. It provides cross-platform functionality for working with files and directories.
Key features include:
The implementation uses the C++17 filesystem library for cross-platform compatibility and modern C++ practices.
void checkFolder | ( | std::string & | folderPath | ) |
Checks if a folder exists and creates it if it doesn't.
Ensures a directory exists, creating it if necessary.
[in,out] | folderPath | Path to the folder to check/create |
This function checks if the specified folder exists. If it doesn't exist, it attempts to create the folder and all necessary parent directories. Status messages are printed to standard output/error streams.
void deleteFolder | ( | const std::string & | path | ) |
Recursively deletes a directory and all its contents.
[in] | path | Path to the directory to be deleted |
This function attempts to delete the specified directory and all its contents recursively. It uses std::filesystem::remove_all() for the operation. Status messages are printed to standard output/error streams.
std::string getExecutableDir | ( | ) |
Gets the directory containing the currently running executable.
Gets the directory containing the current executable.
This function determines the directory containing the currently running executable by resolving the symbolic link at "/proc/self/exe" and returning its parent directory.
std::vector<std::string> listFilesInDirectory | ( | const std::string & | path | ) |
Lists all regular files in the specified directory.
Lists all regular files in a directory.
[in] | path | Path to the directory to scan |
This function scans the specified directory and returns a list of all regular files it contains. The function only includes files (not directories) in the results.