15 #include <sys/types.h>
22 static long GetEpoch(
const std::string &Path) {
24 if (stat(Path.c_str(), &St))
return 0;
30 std::vector<std::string> V;
33 if (*Epoch >= E)
return V;
36 DIR *D = opendir(Dir.c_str());
38 while (
auto E = readdir(D)) {
39 if (E->d_type == DT_REG || E->d_type == DT_LNK)
40 V.push_back(E->d_name);
47 std::ifstream
T(Path);
48 return Unit((std::istreambuf_iterator<char>(T)),
49 std::istreambuf_iterator<char>());
53 std::ifstream
T(Path);
54 return std::string((std::istreambuf_iterator<char>(T)),
55 std::istreambuf_iterator<char>());
63 std::ofstream OF(Path);
64 OF.write((
const char*)U.data(), U.size());
69 long E = Epoch ? *Epoch : 0;
72 if (Epoch &&
GetEpoch(FilePath) < E)
continue;
78 const std::string &FileName) {
79 return DirPath +
"/" + FileName;
83 std::string Cmd =
"base64 -w 0 < " + Path +
"; echo";
90 vfprintf(stderr, Fmt, ap);
void ExecuteCommand(const std::string &Command)
void PrintFileAsBase64(const std::string &Path)
std::string FileToString(const std::string &Path)
void Printf(const char *Fmt,...)
std::string DirPlusFile(const std::string &DirPath, const std::string &FileName)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static long GetEpoch(const std::string &Path)
void CopyFileToErr(const std::string &Path)
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
void WriteToFile(const Unit &U, const std::string &Path)
Unit FileToVector(const std::string &Path)
std::vector< uint8_t > Unit
static std::vector< std::string > ListFilesInDir(const std::string &Dir, long *Epoch)
void ReadDirToVectorOfUnits(const char *Path, std::vector< Unit > *V, long *Epoch)