Various cosmetic tweaks

This commit is contained in:
Claude Brisson
2024-04-11 22:15:47 +02:00
parent bdf412e592
commit 87e10f5cb6
8 changed files with 49 additions and 12 deletions

View File

@@ -138,7 +138,17 @@ class FileStore(pathStr: String): Store {
entries.mapNotNull { entry ->
entry.toFile()
}.firstOrNull()
}?.renameTo(path.resolve(filename + "-${timestamp}").toFile())
}?.let { file ->
val dest = path.resolve(filename + "-${timestamp}").toFile()
if (dest.exists()) {
// it means the user performed several actions in the same second...
// drop the last occurrence
dest.delete()
}
if (!file.renameTo(dest)) {
throw Error("Cannot rename ${file.path} to ${dest.path}")
}
}
addTournament(tournament)
}