|
CPP-TOOLBOX
|
#include "fs_utils.hpp"#include <iostream>#include <fstream>#include <unordered_set>#include <regex>Namespaces | |
| namespace | fs_utils |
Functions | |
| bool | fs_utils::path_exists (const std::string &path) |
| Check if a filesystem path exists. | |
| std::string | fs_utils::normalize_path_for_os (const std::string &path) |
| Normalize a path string to match the current operating system's conventions. | |
| std::string | fs_utils::get_path_delimiter () |
| Get the directory delimiter for the current operating system. | |
| std::filesystem::path | fs_utils::expand_tilde (const std::filesystem::path &path) |
| Expand a leading tilde (~) to the user's home directory. | |
| std::vector< std::filesystem::path > | fs_utils::rec_get_all_files (const std::string &base_dir, const std::vector< std::string > &ignore_dirs, int limit=1000) |
| Recursively get all files from a base directory. | |
| std::filesystem::path | fs_utils::get_directory_from_filepath (const std::filesystem::path &filepath) |
| Extract the directory component from a full file path. | |
| bool | fs_utils::has_extension (const std::filesystem::path &file_path, const std::string &extension) |
| Check if a file path has a specific extension. | |
| std::string | fs_utils::get_containing_directory (const std::string &filepath) |
| Get the containing directory as a string. | |
| std::string | fs_utils::get_filename_from_path (const std::string &path_str) |
| Extract the filename from a full path string. | |
| std::filesystem::path | fs_utils::get_parent_directory (const std::filesystem::path ¤t_dir) |
| Get the parent directory of a given path. | |
| std::filesystem::path | fs_utils::get_home_directory () |
| Get the home directory of the current user. | |
| std::vector< std::filesystem::path > | fs_utils::list_files_and_directories (const std::filesystem::path &path, bool include_hidden=false) |
| List files and directories in a given path. | |
| std::vector< std::filesystem::path > | fs_utils::list_files_in_directory (const std::filesystem::path &path) |
| List only files in a given directory (non-recursive). | |
| std::vector< std::filesystem::path > | fs_utils::list_files_matching_regex (const std::filesystem::path &path, const std::string &pattern_str) |
| List files matching a regular expression pattern. | |
| bool | fs_utils::file_exists_in_same_dir (const std::filesystem::path &file_path, const std::filesystem::path &target_file_name) |
| Check if a target file exists in the same directory as another file. | |
| bool | fs_utils::create_directory (const std::filesystem::path &dir_path) |
| Create a new directory. | |
| bool | fs_utils::create_file_with_content (const std::filesystem::path &file_path, const std::string &content) |
| Create a new file and write content to it. | |
| bool | fs_utils::create_file_with_content_if_different (const std::filesystem::path &file_path, const std::string &content) |
| Create or update a file only if the new content differs from the current one. | |
| std::string | fs_utils::get_directory_of_file (const std::string &file_path) |
| Get the directory containing a given file. | |
| std::filesystem::path | fs_utils::get_relative_path (const std::filesystem::path &source, const std::filesystem::path &target) |
| Get the relative path from a source to a target. | |