The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | #ifndef FILES_H |
| 2 | #define FILES_H |
| 3 | |
| 4 | #include <map> |
| 5 | #include <string> |
| 6 | #include <vector> |
| 7 | #include <sys/types.h> |
| 8 | |
| 9 | using namespace std; |
| 10 | |
Raphael | 0b3ec5d | 2011-09-14 15:07:05 -0700 | [diff] [blame] | 11 | enum FileOpType { |
| 12 | FILE_OP_COPY = 0, |
| 13 | FILE_OP_REMOVE, |
| 14 | FILE_OP_STRIP |
| 15 | }; |
| 16 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 17 | struct FileRecord |
| 18 | { |
Raphael | 0b3ec5d | 2011-09-14 15:07:05 -0700 | [diff] [blame] | 19 | FileRecord(); |
| 20 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | string listFile; |
| 22 | int listLine; |
| 23 | |
| 24 | string sourceBase; |
| 25 | string sourceName; |
| 26 | string sourcePath; |
| 27 | bool sourceIsDir; |
| 28 | time_t sourceMod; |
Raphael | 0b3ec5d | 2011-09-14 15:07:05 -0700 | [diff] [blame] | 29 | off_t sourceSize; |
| 30 | FileOpType fileOp; |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 31 | |
| 32 | string outName; |
| 33 | string outPath; |
Raphael | 0b3ec5d | 2011-09-14 15:07:05 -0700 | [diff] [blame] | 34 | off_t outSize; |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 35 | time_t outMod; |
| 36 | bool outIsDir; |
| 37 | unsigned int mode; |
| 38 | }; |
| 39 | |
| 40 | int read_list_file(const string& filename, |
| 41 | const map<string, string>& variables, |
| 42 | vector<FileRecord>* files, |
| 43 | vector<string>* excludes); |
| 44 | int locate(FileRecord* rec, const vector<string>& search); |
| 45 | void stat_out(const string& base, FileRecord* rec); |
| 46 | string dir_part(const string& filename); |
| 47 | int list_dir(const FileRecord& rec, const vector<string>& excludes, |
| 48 | vector<FileRecord>* files); |
| 49 | |
| 50 | #endif // FILES_H |