perf: Do not check, if the options file exists twice

This commit is contained in:
oSumAtrIX 2023-10-04 04:08:27 +02:00
parent 64afc95a81
commit e3c55507cf
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
1 changed files with 3 additions and 2 deletions

View File

@ -39,8 +39,9 @@ internal object OptionsCommand : Runnable {
override fun run() = try {
PatchBundleLoader.Jar(*patchBundles).let { patches ->
if (!filePath.exists() || overwrite) {
if (update && filePath.exists()) patches.setOptions(filePath)
val exists = filePath.exists()
if (!exists || overwrite) {
if (exists && update) patches.setOptions(filePath)
Options.serialize(patches, prettyPrint = true).let(filePath::writeText)
} else throw OptionsFileAlreadyExistsException()