From 06c7e0b1a8fdac505d595fb96b11f2dfba338da7 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 21 Jan 2025 22:14:45 +0100 Subject: [PATCH] fix part number variable --- app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt b/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt index 76a7d952..0573d0ce 100644 --- a/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt +++ b/app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt @@ -857,16 +857,14 @@ private fun Flash(c: CreatePartDataHolder) { } else { var space = c.desiredSize val imgFolder = SuFile.open(c.vm.logic.abmSdLessBootset, fn) - var i = 0 if (imgFolder.exists()) throw IllegalStateException("image folder ${imgFolder.absolutePath} already exists") if (!imgFolder.mkdir()) throw IllegalStateException("image folder ${imgFolder.absolutePath} could not be created") c.parts.forEachIndexed { index, part -> terminal.add(vm.activity.getString(R.string.term_create_part)) - val id = i++ - val img = File(imgFolder, id.toString()) - val map = File(entryFolder, "$id.map") + val img = File(imgFolder, index.toString()) + val map = File(entryFolder, "$index.map") val bytes = part.resolveBytesSize(c, space) space -= bytes if (space < 0) @@ -879,11 +877,11 @@ private fun Flash(c: CreatePartDataHolder) { terminal.add(vm.activity.getString(R.string.term_failed_uncrypt)) return@WizardTerminalWork } - if (!vm.logic.map(fn, id, terminal)) { + if (!vm.logic.map(fn, index, terminal)) { terminal.add(vm.activity.getString(R.string.term_failed_map_other)) return@WizardTerminalWork } - createdParts.add(part to (i to vm.logic.getDmFile(fn, id))) + createdParts.add(part to (index to vm.logic.getDmFile(fn, index))) terminal.add(vm.activity.getString(R.string.term_created_part)) } }