Ring Daemon 16.0.0
Loading...
Searching...
No Matches
fileutils.h File Reference
Include dependency graph for fileutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  jami::fileutils::ArchiveStorageData
 

Namespaces

namespace  jami
 
namespace  jami::fileutils
 

Macros

#define DIR_SEPARATOR_CH   '/'
 
#define DIR_SEPARATOR_STR   "/"
 
#define DIR_SEPARATOR_STR_ESC   "\\/"
 

Functions

int jami::fileutils::accessFile (const std::string &file, int mode)
 Windows compatibility wrapper for checking read-only attribute.
 
bool jami::fileutils::createFileLink (const std::filesystem::path &linkFile, const std::filesystem::path &target, bool hard)
 
std::string jami::fileutils::expand_path (const std::string &path)
 Expand the given path.
 
const std::filesystem::path & jami::fileutils::get_cache_dir ()
 
std::filesystem::path jami::fileutils::get_cache_dir (const char *pkg)
 
const std::filesystem::path & jami::fileutils::get_config_dir ()
 
std::filesystem::path jami::fileutils::get_config_dir (const char *pkg)
 
const std::filesystem::path & jami::fileutils::get_data_dir ()
 
std::filesystem::path jami::fileutils::get_data_dir (const char *pkg)
 
const std::filesystem::path & jami::fileutils::get_home_dir ()
 
const std::filesystem::path & jami::fileutils::get_resource_dir_path ()
 Get the resource directory path that was set with set_resource_dir_path.
 
std::string jami::fileutils::getCleanPath (const std::string &base, const std::string &path)
 If path is contained in base, return the suffix, otherwise return the full path.
 
std::string_view jami::fileutils::getFileExtension (std::string_view filename)
 
std::filesystem::path jami::fileutils::getFullPath (const std::filesystem::path &base, const std::filesystem::path &path)
 If path is relative, it is appended to base.
 
bool jami::fileutils::isDirectoryWritable (const std::string &directory)
 
bool jami::fileutils::isPathRelative (const std::filesystem::path &path)
 
uint64_t jami::fileutils::lastWriteTimeInSeconds (const std::filesystem::path &filePath)
 Return the last write time (epoch time) of a given file path (in seconds).
 
std::vector< uint8_tjami::fileutils::loadCacheFile (const std::filesystem::path &path, std::chrono::system_clock::duration maxAge)
 
std::string jami::fileutils::loadCacheTextFile (const std::filesystem::path &path, std::chrono::system_clock::duration maxAge)
 
std::vector< uint8_tjami::fileutils::loadFile (const std::filesystem::path &path, const std::filesystem::path &default_dir={})
 Read the full content of a file at path.
 
std::string jami::fileutils::loadTextFile (const std::filesystem::path &path, const std::filesystem::path &default_dir)
 
ArchiveStorageData jami::fileutils::readArchive (const std::filesystem::path &path, std::string_view scheme, const std::string &pwd)
 
void jami::fileutils::saveFile (const std::filesystem::path &path, const std::vector< uint8_t > &data, mode_t mode=0644)
 
void jami::fileutils::saveFile (const std::filesystem::path &path, const uint8_t *data, size_t data_size, mode_t mode=0644)
 
void jami::fileutils::set_resource_dir_path (const std::filesystem::path &resourceDirPath)
 Set the program's resource directory path.
 
std::string jami::fileutils::sha3File (const std::filesystem::path &path)
 
std::string jami::fileutils::sha3sum (const std::vector< uint8_t > &buffer)
 
int64_t jami::fileutils::size (const std::filesystem::path &path)
 
bool jami::fileutils::writeArchive (const std::string &archive_str, const std::filesystem::path &path, std::string_view scheme, const std::string &password, const std::vector< uint8_t > &password_salt)
 

Variables

static constexpr auto jami::fileutils::ARCHIVE_AUTH_SCHEME_KEY = "key"sv
 
static constexpr auto jami::fileutils::ARCHIVE_AUTH_SCHEME_NONE = ""sv
 
static constexpr auto jami::fileutils::ARCHIVE_AUTH_SCHEME_PASSWORD = "password"sv
 

Macro Definition Documentation

◆ DIR_SEPARATOR_CH

#define DIR_SEPARATOR_CH   '/'

Definition at line 34 of file fileutils.h.

◆ DIR_SEPARATOR_STR

#define DIR_SEPARATOR_STR   "/"

Definition at line 33 of file fileutils.h.

◆ DIR_SEPARATOR_STR_ESC

#define DIR_SEPARATOR_STR_ESC   "\\/"

Definition at line 35 of file fileutils.h.