Skip to content

Commit 1ec3ab3

Browse files
committed
修复每次运行会产生多余换行的问题
1 parent cff11d6 commit 1ec3ab3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ func updateConfFile(confPath string, trackers []string) error {
9393
!strings.HasPrefix(line, "bt-tracker-") {
9494
line = "bt-tracker=" + strings.Join(trackers, ",") + "\n"
9595
}
96+
if bufw.Len() > 0 {
97+
bufw.WriteString("\n")
98+
}
9699
bufw.WriteString(line)
97-
bufw.WriteString("\n")
98100
}
99101
file.Seek(0, 0)
100102
_, err = file.WriteString(bufw.String())

0 commit comments

Comments
 (0)