This commit is contained in:
Mitchell Syer
2022-10-22 08:08:14 -04:00
committed by GitHub
parent 3bef07eeab
commit a3c366c360
54 changed files with 159 additions and 109 deletions

View File

@@ -67,7 +67,9 @@ object BytecodeEditor {
}
path to bytes
} else null
} else {
null
}
} catch (e: Exception) {
logger.error(e) { "Error loading class from Path: $path" }
null
@@ -172,7 +174,11 @@ object BytecodeEditor {
): MethodVisitor {
logger.trace { "Processing method $name: ${desc.replaceIndirectly()}: $signature" }
val mv: MethodVisitor? = super.visitMethod(
access, name, desc.replaceIndirectly(), signature, exceptions
access,
name,
desc.replaceIndirectly(),
signature,
exceptions
)
return object : MethodVisitor(Opcodes.ASM5, mv) {
override fun visitLdcInsn(cst: Any?) {

View File

@@ -60,7 +60,9 @@ fun updateMangaDownloadDir(mangaId: Int, newTitle: String): Boolean {
val oldDirFile = File(oldDir)
val newDirFile = File(newDir)
return if (oldDirFile.exists())
return if (oldDirFile.exists()) {
oldDirFile.renameTo(newDirFile)
else true
} else {
true
}
}

View File

@@ -37,11 +37,13 @@ private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutin
}
override fun onCompleted() {
if (cont.isActive) cont.resumeWithException(
IllegalStateException(
"Should have invoked onNext"
if (cont.isActive) {
cont.resumeWithException(
IllegalStateException(
"Should have invoked onNext"
)
)
)
}
}
override fun onError(e: Throwable) {

View File

@@ -21,8 +21,9 @@ object ImageResponse {
fun findFileNameStartingWith(directoryPath: String, fileName: String): String? {
val target = "$fileName."
File(directoryPath).listFiles().orEmpty().forEach { file ->
if (file.name.startsWith(target))
if (file.name.startsWith(target)) {
return "$directoryPath/${file.name}"
}
}
return null
}