blob: f6bf8a6ad578d4c4884d9b77ef098b9eda9238b9 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001#ifndef FILES_H
2#define FILES_H
3
4#include <map>
5#include <string>
6#include <vector>
7#include <sys/types.h>
8
9using namespace std;
10
Raphael0b3ec5d2011-09-14 15:07:05 -070011enum FileOpType {
12 FILE_OP_COPY = 0,
13 FILE_OP_REMOVE,
14 FILE_OP_STRIP
15};
16
The Android Open Source Project88b60792009-03-03 19:28:42 -080017struct FileRecord
18{
Raphael0b3ec5d2011-09-14 15:07:05 -070019 FileRecord();
20
The Android Open Source Project88b60792009-03-03 19:28:42 -080021 string listFile;
22 int listLine;
23
24 string sourceBase;
25 string sourceName;
26 string sourcePath;
27 bool sourceIsDir;
28 time_t sourceMod;
Raphael0b3ec5d2011-09-14 15:07:05 -070029 off_t sourceSize;
30 FileOpType fileOp;
The Android Open Source Project88b60792009-03-03 19:28:42 -080031
32 string outName;
33 string outPath;
Raphael0b3ec5d2011-09-14 15:07:05 -070034 off_t outSize;
The Android Open Source Project88b60792009-03-03 19:28:42 -080035 time_t outMod;
36 bool outIsDir;
37 unsigned int mode;
38};
39
40int read_list_file(const string& filename,
41 const map<string, string>& variables,
42 vector<FileRecord>* files,
43 vector<string>* excludes);
44int locate(FileRecord* rec, const vector<string>& search);
45void stat_out(const string& base, FileRecord* rec);
46string dir_part(const string& filename);
47int list_dir(const FileRecord& rec, const vector<string>& excludes,
48 vector<FileRecord>* files);
49
50#endif // FILES_H