Skip to content

Commit

Permalink
perf: Do not check, if the options file exists twice
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Oct 4, 2023
1 parent 64afc95 commit e3c5550
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/kotlin/app/revanced/cli/command/OptionsCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e3c5550

Please sign in to comment.