44std::filesystem::path
expand_tilde(
const std::filesystem::path &path);
86bool has_extension(
const std::filesystem::path &file_path,
const std::string &extension);
95 bool include_hidden =
false);
111 const std::string &pattern_str);
121 const std::vector<std::string> &ignore_dirs,
int limit = 1000);
129bool file_exists_in_same_dir(
const std::filesystem::path &file_path,
const std::filesystem::path &target_file_name);
179std::filesystem::path
get_relative_path(
const std::filesystem::path &source,
const std::filesystem::path &target);
std::filesystem::path get_parent_directory(const std::filesystem::path ¤t_dir)
Get the parent directory of a given path.
Definition fs_utils.cpp:107
std::vector< std::filesystem::path > list_files_in_directory(const std::filesystem::path &path)
List only files in a given directory (non-recursive).
Definition fs_utils.cpp:149
std::string get_filename_from_path(const std::string &path_str)
Extract the filename from a full path string.
Definition fs_utils.cpp:103
std::string normalize_path_for_os(const std::string &path)
Normalize a path string to match the current operating system's conventions.
Definition fs_utils.cpp:11
bool 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.
Definition fs_utils.cpp:242
std::string get_path_delimiter()
Get the directory delimiter for the current operating system.
Definition fs_utils.cpp:24
bool create_file_with_content(const std::filesystem::path &file_path, const std::string &content)
Create a new file and write content to it.
Definition fs_utils.cpp:221
std::filesystem::path get_relative_path(const std::filesystem::path &source, const std::filesystem::path &target)
Get the relative path from a source to a target.
Definition fs_utils.cpp:275
bool 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.
Definition fs_utils.cpp:173
bool create_directory(const std::filesystem::path &dir_path)
Create a new directory.
Definition fs_utils.cpp:208
std::vector< std::filesystem::path > list_files_and_directories(const std::filesystem::path &path, bool include_hidden)
List files and directories in a given path.
Definition fs_utils.cpp:132
std::string get_containing_directory(const std::string &filepath)
Get the containing directory as a string.
Definition fs_utils.cpp:97
std::filesystem::path expand_tilde(const std::filesystem::path &path)
Expand a leading tilde (~) to the user's home directory.
Definition fs_utils.cpp:26
std::vector< std::filesystem::path > rec_get_all_files(const std::string &base_dir, const std::vector< std::string > &ignore_dirs, int limit)
Recursively get all files from a base directory.
Definition fs_utils.cpp:40
std::filesystem::path get_home_directory()
Get the home directory of the current user.
Definition fs_utils.cpp:118
std::vector< std::filesystem::path > list_files_matching_regex(const std::filesystem::path &path, const std::string &pattern_str)
List files matching a regular expression pattern.
Definition fs_utils.cpp:154
bool path_exists(const std::string &path)
Check if a filesystem path exists.
Definition fs_utils.cpp:9
std::string get_directory_of_file(const std::string &file_path)
Get the directory containing a given file.
Definition fs_utils.cpp:270
bool has_extension(const std::filesystem::path &file_path, const std::string &extension)
Check if a file path has a specific extension.
Definition fs_utils.cpp:88
std::filesystem::path get_directory_from_filepath(const std::filesystem::path &filepath)
Extract the directory component from a full file path.
Definition fs_utils.cpp:84