Fcitx
Functions
fs.h File Reference

Simple file system related API for checking file status. More...

#include <sys/types.h>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>
#include <fcitx-utils/fcitxutils_export.h>
#include <fcitx-utils/misc.h>
Include dependency graph for fs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool fcitx::fs::isdir (const std::string &path)
 check whether path is a directory.
 
bool fcitx::fs::isreg (const std::string &path)
 check whether path is a regular file.
 
bool fcitx::fs::isexe (const std::string &path)
 check whether path is an executable regular file. More...
 
bool fcitx::fs::islnk (const std::string &path)
 check whether path is a link.
 
std::string fcitx::fs::cleanPath (const std::string &path)
 Get the clean path by removing . , .. , and duplicate / in the path.
 
bool fcitx::fs::makePath (const std::filesystem::path &path)
 Create directory recursively.
 
std::string fcitx::fs::dirName (const std::string &path)
 Get directory name of path.
 
std::string fcitx::fs::baseName (std::string_view path)
 Get base file name of path.
 
ssize_t fcitx::fs::safeRead (int fd, void *data, size_t maxlen)
 a simple wrapper around read(), ignore EINTR.
 
ssize_t fcitx::fs::safeWrite (int fd, const void *data, size_t maxlen)
 a simple wrapper around write(), ignore EINTR.
 
std::optional< std::string > fcitx::fs::readlink (const std::string &path)
 read symlink.
 
int64_t fcitx::fs::modifiedTime (const std::filesystem::path &path)
 Return modified time in seconds of given path. More...
 
UniqueFilePtr fcitx::fs::openFD (UnixFD &fd, const char *modes)
 open the unix fd with fdopen. More...
 
FCITXUTILS_DEPRECATED_EXPORT UniqueFilePtr fcitx::fs::openFD (StandardPathFile &file, const char *modes)
 open the standard path file fd with fdopen. More...
 

Detailed Description

Simple file system related API for checking file status.

Definition in file fs.h.