28#if !defined(_WIN32) && !defined(O_BINARY)
33#if defined(_WIN32) && !defined(O_CLOEXEC)
35#define O_CLOEXEC O_NOINHERIT
54 void init(
const std::string& tmp_dir);
71 bool init(
const std::string& tmp_dir);
83 bool follow_symlinks =
false);
86 bool follow_symlinks =
false);
91 mode_t mode, uid_t owner, gid_t group,
92 bool follow_symlinks =
false);
107bool WriteFully(borrowed_fd fd,
const void*
data,
size_t byte_count);
113bool Realpath(
const std::string& path, std::string* result);
114bool Readlink(
const std::string& path, std::string* result);
122std::string
Basename(std::string_view path);
123std::string
Dirname(std::string_view path);
DISALLOW_COPY_AND_ASSIGN(TemporaryDir)
TemporaryDir()
Definition: file.cpp:168
char path[1024]
Definition: file.h:68
bool remove_dir_and_contents_
Definition: file.h:73
void DoNotRemove()
Definition: file.h:66
~TemporaryDir()
Definition: file.cpp:172
bool init(const std::string &tmp_dir)
Definition: file.cpp:203
bool remove_file_
Definition: file.h:56
void init(const std::string &tmp_dir)
Definition: file.cpp:159
int fd
Definition: file.h:50
int release()
Definition: file.cpp:153
~TemporaryFile()
Definition: file.cpp:144
DISALLOW_COPY_AND_ASSIGN(TemporaryFile)
char path[1024]
Definition: file.h:51
TemporaryFile()
Definition: file.cpp:136
void DoNotRemove()
Definition: file.h:48
char data[Size]
Definition: incremental_server.cpp:1
bool ReadFdToString(borrowed_fd fd, std::string *content)
Definition: file.cpp:218
bool ReadFully(borrowed_fd fd, void *data, size_t byte_count)
Definition: file.cpp:311
bool WriteFullyAtOffset(borrowed_fd fd, const void *data, size_t byte_count, off64_t offset)
Definition: file.cpp:369
bool WriteStringToFile(const std::string &content, const std::string &path, mode_t mode, uid_t owner, gid_t group, bool follow_symlinks)
Definition: file.cpp:271
std::string GetExecutableDirectory()
Definition: file.cpp:498
std::string GetExecutablePath()
Definition: file.cpp:470
bool ReadFileToString(const std::string &path, std::string *content, bool follow_symlinks)
Definition: file.cpp:237
std::string Basename(std::string_view path)
Definition: file.cpp:580
bool Realpath(const std::string &path, std::string *result)
Definition: file.cpp:452
std::string Dirname(std::string_view path)
Definition: file.cpp:672
bool ReadFullyAtOffset(borrowed_fd fd, void *data, size_t byte_count, off64_t offset)
Definition: file.cpp:357
bool WriteFully(borrowed_fd fd, const void *data, size_t byte_count)
Definition: file.cpp:382
bool Readlink(const std::string &path, std::string *result)
Definition: file.cpp:428
bool WriteStringToFd(std::string_view content, borrowed_fd fd)
Definition: file.cpp:248
bool RemoveFileIfExists(const std::string &path, std::string *err)
Definition: file.cpp:394