@@ -47,19 +47,6 @@ std::string strip_parent_path(const std::string & relative_path)
47
47
{
48
48
return fs::path (relative_path).filename ().generic_string ();
49
49
}
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
-
63
50
} // namespace
64
51
65
52
SequentialWriter::SequentialWriter (
@@ -203,11 +190,7 @@ void SequentialWriter::close()
203
190
}
204
191
205
192
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);
209
193
storage_.reset (); // Destroy storage before calling WRITE_SPLIT callback to make sure that
210
- fs::rename (active_path, final_path);
211
194
// bag file was closed before callback call.
212
195
}
213
196
if (!metadata_.relative_file_paths .empty ()) {
@@ -326,7 +309,7 @@ std::string SequentialWriter::format_storage_uri(
326
309
// SequentialWriter is opened with a relative path.
327
310
std::stringstream storage_file_name;
328
311
storage_file_name << fs::path (base_folder).filename ().generic_string () << " _" <<
329
- storage_count << " .active " ;
312
+ storage_count;
330
313
331
314
return (fs::path (base_folder) / storage_file_name.str ()).generic_string ();
332
315
}
@@ -343,15 +326,7 @@ void SequentialWriter::switch_to_next_storage()
343
326
storage_options_.uri = format_storage_uri (
344
327
base_folder_,
345
328
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
-
351
329
storage_ = storage_factory_->open_read_write (storage_options_);
352
-
353
- std::filesystem::rename (active_path, final_path);
354
-
355
330
if (!storage_) {
356
331
std::stringstream errmsg;
357
332
errmsg << " Failed to rollover bagfile to new file: \" " << storage_options_.uri << " \" !" ;
0 commit comments