0b3ec5d32f
The new line syntax is: [SRC] [rm|strip] DEST This allows one to write things like this in atree: bin/src bin/src bin/dest bin/src "bin/another file name" rm dest/file rm dest/dir # recursive strip bin/src bin/src strip bin/dest Src and dest can contain spaces if full enclosed in double-quotes. The strip command can be overridden using the STRIP env var. Change-Id: I22aae7a87c36c082e1aab87132099a3c644914da
50 lines
1 KiB
C++
50 lines
1 KiB
C++
#ifndef FILES_H
|
|
#define FILES_H
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <sys/types.h>
|
|
|
|
using namespace std;
|
|
|
|
enum FileOpType {
|
|
FILE_OP_COPY = 0,
|
|
FILE_OP_REMOVE,
|
|
FILE_OP_STRIP
|
|
};
|
|
|
|
struct FileRecord
|
|
{
|
|
FileRecord();
|
|
|
|
string listFile;
|
|
int listLine;
|
|
|
|
string sourceBase;
|
|
string sourceName;
|
|
string sourcePath;
|
|
bool sourceIsDir;
|
|
time_t sourceMod;
|
|
off_t sourceSize;
|
|
FileOpType fileOp;
|
|
|
|
string outName;
|
|
string outPath;
|
|
off_t outSize;
|
|
time_t outMod;
|
|
bool outIsDir;
|
|
unsigned int mode;
|
|
};
|
|
|
|
int read_list_file(const string& filename,
|
|
const map<string, string>& variables,
|
|
vector<FileRecord>* files,
|
|
vector<string>* excludes);
|
|
int locate(FileRecord* rec, const vector<string>& search);
|
|
void stat_out(const string& base, FileRecord* rec);
|
|
string dir_part(const string& filename);
|
|
int list_dir(const FileRecord& rec, const vector<string>& excludes,
|
|
vector<FileRecord>* files);
|
|
|
|
#endif // FILES_H
|