@@ -47,19 +47,6 @@ std::string strip_parent_path(const std::string & relative_path)
4747{
4848 return fs::path (relative_path).filename ().generic_string ();
4949}
50-
51- std::string remove_active_from_filename (const std::string& relative_path)
52- {
53- fs::path path (relative_path);
54- auto filename = path.filename ().string ();
55- auto active_pos = filename.find (" .active" );
56- if (active_pos != std::string::npos) {
57- filename.replace (active_pos, 7 , " " );
58- }
59- auto new_path = path.parent_path () / filename;
60- return new_path.string ();
61- }
62-
6350} // namespace
6451
6552SequentialWriter::SequentialWriter (
@@ -203,11 +190,7 @@ void SequentialWriter::close()
203190 }
204191
205192 if (storage_) {
206- // when the storage_ is closed, rename the file to remove ".active" suffix
207- std::string active_path = storage_->get_relative_file_path ();
208- std::string final_path = remove_active_from_filename (active_path);
209193 storage_.reset (); // Destroy storage before calling WRITE_SPLIT callback to make sure that
210- fs::rename (active_path, final_path);
211194 // bag file was closed before callback call.
212195 }
213196 if (!metadata_.relative_file_paths .empty ()) {
@@ -326,7 +309,7 @@ std::string SequentialWriter::format_storage_uri(
326309 // SequentialWriter is opened with a relative path.
327310 std::stringstream storage_file_name;
328311 storage_file_name << fs::path (base_folder).filename ().generic_string () << " _" <<
329- storage_count << " .active " ;
312+ storage_count;
330313
331314 return (fs::path (base_folder) / storage_file_name.str ()).generic_string ();
332315}
@@ -343,15 +326,7 @@ void SequentialWriter::switch_to_next_storage()
343326 storage_options_.uri = format_storage_uri (
344327 base_folder_,
345328 metadata_.relative_file_paths .size ());
346-
347- // when the storage_ is closed, rename the file to remove ".active" suffix
348- std::string active_path = storage_->get_relative_file_path ();
349- std::string final_path = remove_active_from_filename (active_path);
350-
351329 storage_ = storage_factory_->open_read_write (storage_options_);
352-
353- std::filesystem::rename (active_path, final_path);
354-
355330 if (!storage_) {
356331 std::stringstream errmsg;
357332 errmsg << " Failed to rollover bagfile to new file: \" " << storage_options_.uri << " \" !" ;
0 commit comments