Add code to generate LATEST pointer

This commit is contained in:
2020-04-17 10:35:40 +02:00
parent a91aa6a060
commit 97831ec4f2
2 changed files with 21 additions and 0 deletions
+20
View File
@@ -16,7 +16,19 @@ BinaryWriter::BinaryWriter(
current_filename_(""),
output_fd_(-1)
{
latest_filename_ = root_folder + "/" + device_name + "/LATEST";
#ifdef DEBUG_OUTPUT
using namespace date;
using namespace chrono;
cout << "[" << system_clock::now() << "]";
cout << "[BinaryWriter::BinaryWriter]";
cout << " Starting with";
cout << " device_name " << device_name_;
cout << " root_folder_ " << root_folder_;
cout << " latest_filename_ " << latest_filename_;
cout << endl;
#endif
}
void BinaryWriter::write(uint64_t pulse_id, const JFFileFormat& buffer)
@@ -40,5 +52,13 @@ void BinaryWriter::close_current_file()
throw runtime_error(err_msg.str());
}
// TODO: Ugly hack, please please fix it.
stringstream latest_command;
latest_command << "echo " << current_filename_;
latest_command << " > " << latest_filename_;
auto str_latest_command = latest_command.str();
system(str_latest_command.c_str());
}
}