|
|
@ -29,9 +29,11 @@ void file_helper::open(const filename_t &fname, bool truncate) {
|
|
|
|
if (event_handlers_.before_open) {
|
|
|
|
if (event_handlers_.before_open) {
|
|
|
|
event_handlers_.before_open(filename_);
|
|
|
|
event_handlers_.before_open(filename_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int tries = 0; tries < open_tries_; ++tries) {
|
|
|
|
|
|
|
|
// create containing folder if not exists already.
|
|
|
|
// create containing folder if not exists already.
|
|
|
|
os::create_dir(os::dir_name(fname));
|
|
|
|
os::create_dir(os::dir_name(fname));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int tries = 0; tries < open_tries_; ++tries) {
|
|
|
|
if (truncate) {
|
|
|
|
if (truncate) {
|
|
|
|
// Truncate by opening-and-closing a tmp file in "wb" mode, always
|
|
|
|
// Truncate by opening-and-closing a tmp file in "wb" mode, always
|
|
|
|
// opening the actual log-we-write-to in "ab" mode, since that
|
|
|
|
// opening the actual log-we-write-to in "ab" mode, since that
|
|
|
|