mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
[paker] Create files before writing.
This commit is contained in:
parent
cf989f4d5b
commit
3541f7a2ad
1 changed files with 4 additions and 2 deletions
|
|
@ -111,8 +111,11 @@ int main(int argc, char *argv[]) {
|
||||||
p.n_files = files.size();
|
p.n_files = files.size();
|
||||||
p.n_blocks = nsegs;
|
p.n_blocks = nsegs;
|
||||||
|
|
||||||
|
fs::create_directories(name.parent_path());
|
||||||
|
std::ofstream{name};
|
||||||
|
fs::resize_file(name, total);
|
||||||
primitives::templates2::mmap_file<uint8_t> f{name, primitives::templates2::mmap_file<uint8_t>::rw{}};
|
primitives::templates2::mmap_file<uint8_t> f{name, primitives::templates2::mmap_file<uint8_t>::rw{}};
|
||||||
f.alloc_raw(total);
|
//f.alloc_raw(total);
|
||||||
|
|
||||||
stream s{f};
|
stream s{f};
|
||||||
s = p;
|
s = p;
|
||||||
|
|
@ -141,7 +144,6 @@ int main(int argc, char *argv[]) {
|
||||||
s.skip(sz_to_copy);
|
s.skip(sz_to_copy);
|
||||||
}
|
}
|
||||||
f.close();
|
f.close();
|
||||||
fs::resize_file(name, total);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue