fswatch 1.20.1
Loading...
Searching...
No Matches
path_utils.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2024 Enrico M. Crisostomo
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation; either version 3, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 * details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
25
26#ifndef FSW_PATH_UTILS_H
27# define FSW_PATH_UTILS_H
28
29# include <string>
30# include <vector>
31# include <filesystem>
32# include <sys/stat.h>
33
34namespace fsw
35{
43 std::vector<std::filesystem::directory_entry> get_directory_entries(const std::filesystem::path& path);
44
51 std::vector<std::filesystem::directory_entry> get_subdirectories(const std::filesystem::path& path);
52
61 bool lstat_path(const std::string& path, struct stat& fd_stat);
62
71 bool stat_path(const std::string& path, struct stat& fd_stat);
72
85 bool stat_path(const std::string& path, struct stat& fd_stat, bool follow_symlink);
86}
87#endif /* FSW_PATH_UTILS_H */
Main namespace of libfswatch.
Definition event.cpp:24
bool stat_path(const std::string &path, struct stat &fd_stat, bool follow_symlink)
Wraps a stat(path, fd_stat) call or a lstat(path, fd_stat) call, depending on the value of follow_sym...
Definition path_utils.cpp:66
std::vector< std::filesystem::directory_entry > get_subdirectories(const std::filesystem::path &path)
Gets a vector of direct subdirectories.
Definition path_utils.cpp:47
bool lstat_path(const std::string &path, struct stat &fd_stat)
Wraps a lstat(path, fd_stat) call that invokes perror() if it fails.
Definition path_utils.cpp:80
std::vector< std::filesystem::directory_entry > get_directory_entries(const std::filesystem::path &path)
Gets a vector of direct directory entries.
Definition path_utils.cpp:28