numberedFile adds the number between the file name and the extension.
(name string, num int)
| 395 | |
| 396 | // numberedFile adds the number between the file name and the extension. |
| 397 | func numberedFile(name string, num int) string { |
| 398 | ext := filepath.Ext(name) // contains the dot |
| 399 | withoutExt := name[:len(name)-len(ext)] |
| 400 | return fmt.Sprintf("%s.%d%s", withoutExt, num, ext) |
| 401 | } |
| 402 | |
| 403 | // An autoclosedFile is an io.WriteCloser that opens itself for appending on |
| 404 | // Write() and closes itself after an interval of no writes (closeDelay) or |
no outgoing calls