2009-03-04 04:28:42 +01:00
|
|
|
#ifndef FILES_H
|
|
|
|
#define FILES_H
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2011-09-15 00:07:05 +02:00
|
|
|
enum FileOpType {
|
|
|
|
FILE_OP_COPY = 0,
|
|
|
|
FILE_OP_REMOVE,
|
|
|
|
FILE_OP_STRIP
|
|
|
|
};
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
struct FileRecord
|
|
|
|
{
|
2011-09-15 00:07:05 +02:00
|
|
|
FileRecord();
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
string listFile;
|
|
|
|
int listLine;
|
|
|
|
|
|
|
|
string sourceBase;
|
|
|
|
string sourceName;
|
|
|
|
string sourcePath;
|
|
|
|
bool sourceIsDir;
|
|
|
|
time_t sourceMod;
|
2011-09-15 00:07:05 +02:00
|
|
|
off_t sourceSize;
|
|
|
|
FileOpType fileOp;
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
string outName;
|
|
|
|
string outPath;
|
2011-09-15 00:07:05 +02:00
|
|
|
off_t outSize;
|
2009-03-04 04:28:42 +01:00
|
|
|
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
|