Skip to content

Commit

Permalink
fix part number variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 authored Jan 21, 2025
1 parent 90ecc98 commit 06c7e0b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/src/main/java/org/andbootmgr/app/CreatePartFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))
}
}
Expand Down

0 comments on commit 06c7e0b

Please sign in to comment.