27 #define ROUND_PAGE(_X) (((_X) % PAGE_SIZE == 0) ? (_X) : (((_X) / PAGE_SIZE + 1) * PAGE_SIZE)) 28 #define PAGE_SIZE (64 * 1024) 37 paths.push_back(filePath);
42 std::ofstream out(
archPath, std::ofstream::binary);
50 uint32_t num =
paths.size();
51 out.write((
char*) &num,
sizeof(num));
53 uint64_t header_size = (uint64_t) out.tellp();
60 for (
int i = 0; i <
paths.size(); i++)
62 std::ifstream input(
paths[i]);
65 input.seekg(0, input.end);
66 uint64_t length = input.tellg();
67 entries[i].
length = length;
69 if (i <
paths.size() - 1)
70 entries[i+1].offset =
ROUND_PAGE(entries[i].offset + length);
72 out.write((
char*) entries,
paths.size() *
sizeof(
entry_t));
80 for (
int i = 0; i <
paths.size(); i++)
82 std::ifstream input(
paths[i], std::ifstream::binary);
95 std::ifstream in(
archPath, std::ifstream::binary);
99 char buf[
sizeof(
MAGIC)];
100 in.read(buf,
sizeof(
MAGIC));
106 in.read((
char*) &num,
sizeof(num));
108 for (
int i = 0; i < num; i++)
111 in.read((
char*) &e,
sizeof(e));
112 entries.push_back(e);
void getEntries(std::vector< entry_t > &entries)
Archive(const string &path)
std::vector< string > paths
void addFile(const string &filePath)
Thrown if a file was not found.
Thrown if a file was not writeable.
#define ROUND_PAGE(_X)
This file is part of alaCarte.
boost::error_info< struct TagFileName, string > InfoFileName
Use this to inform about a file name.