You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
767 B

#include "webfuse_provider/utils/file_utils.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
namespace webfuse_test
{
bool is_dir(std::string const & path)
{
struct stat info;
int rc = stat(path.c_str(), &info);
return (0 == rc) && (S_ISDIR(info.st_mode));
}
bool is_symlink(std::string const & path)
{
struct stat info;
int rc = lstat(path.c_str(), &info);
return (0 == rc) && (S_ISLNK(info.st_mode));
}
bool is_same_path(std::string const & path, std::string const & other)
{
struct stat info;
int rc = stat(path.c_str(), &info);
struct stat info_other;
int rc_other = stat(other.c_str(), &info_other);
return (0 == rc) && (0 == rc_other) && (info.st_ino == info_other.st_ino);
}
}