Repository navigation
Commit c36e8c4
authored
Preserve the previous session log across restarts (#1846)
re2_framework_log.txt was opened with truncate=true, so the previous
session's log was destroyed as soon as the framework was loaded. After a
crash this made it impossible to inspect the log of the session that
crashed: restarting the game, which is the first thing anyone does, had
already overwritten it.
Rename the existing log to re2_framework_log.prev.txt before creating the
logger, so the previous session survives a restart. All filesystem calls
use the std::error_code overloads, so a failure (e.g. a locked file)
quietly falls back to the old behaviour instead of blocking startup. At
most one previous session is kept: an existing .prev.txt is removed before
the rename.1 parent d7d59ad commit c36e8c4
1 file changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
260 | 259 | | |
261 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
262 | 283 | | |
263 | 284 | | |
264 | 285 | | |
| |||
270 | 291 | | |
271 | 292 | | |
272 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
273 | 298 | | |
274 | 299 | | |
275 | 300 | | |
| |||
0 commit comments