Skip to content

Commit f17e680

Browse files
committed
fix: use log.log_number directly in format_export_path for consistency
- Change format_export_path parameter from log_index to log_number (1-based) - Use log.log_number directly instead of computed log_index + 1 - Aligns with export.rs behavior which uses log.log_number for file suffix - Eliminates fragile dual calculation that could drift if assumptions change - All call sites updated to pass log.log_number - No change to output data (87/87 CSV files still match master)
1 parent ad8335f commit f17e680

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/main.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ fn get_output_dir<'a>(export_options: &'a ExportOptions, file_path: &'a Path) ->
5151

5252
/// Helper to format export path and log suffix for status messages.
5353
/// Computes base filename, output directory, and log suffix (with .NN suffix only for multiple logs).
54+
/// Uses log_number (1-based) directly to match export.rs behavior.
5455
fn format_export_path(
5556
file_path: &Path,
5657
export_options: &ExportOptions,
57-
log_index: usize,
58+
log_number: usize,
5859
total_logs: usize,
5960
) -> (String, String, String) {
6061
let base_name = file_path
@@ -64,7 +65,7 @@ fn format_export_path(
6465
.to_string();
6566
let output_dir = get_output_dir(export_options, file_path).to_string();
6667
let log_suffix = if total_logs > 1 {
67-
format!(".{:02}", log_index + 1)
68+
format!(".{:02}", log_number)
6869
} else {
6970
"".to_string()
7071
};
@@ -1106,7 +1107,7 @@ fn parse_bbl_file_streaming(
11061107
let (base_name, output_dir, log_suffix) = format_export_path(
11071108
file_path,
11081109
export_options,
1109-
log_index,
1110+
log.log_number,
11101111
log_positions.len(),
11111112
);
11121113
println!(
@@ -1146,7 +1147,7 @@ fn parse_bbl_file_streaming(
11461147
let (base_name, output_dir, log_suffix) = format_export_path(
11471148
file_path,
11481149
export_options,
1149-
log_index,
1150+
log.log_number,
11501151
log_positions.len(),
11511152
);
11521153
println!(
@@ -1180,7 +1181,7 @@ fn parse_bbl_file_streaming(
11801181
let (base_name, output_dir, log_suffix) = format_export_path(
11811182
file_path,
11821183
export_options,
1183-
log_index,
1184+
log.log_number,
11841185
log_positions.len(),
11851186
);
11861187
println!(

0 commit comments

Comments
 (0)