fix: use locale-independent formatting for LSPatch output filename (#4)

Fixes installation failures on non-Latin locales by ensuring the LSPatch
output filename lookup uses Latin numerals regardless of device locale.

LSPatch uses String.format(Locale.getDefault(), ...) which produces
locale-specific numerals (e.g., Arabic numerals on Arabic locales),
but the filename lookup was using hardcoded Latin numerals, causing
a mismatch that resulted in "Invalid package" errors.

Fixes #XXXX
This commit is contained in:
kmmiio99o 2026-06-09 11:22:11 +00:00 • committed by GitHub
parent eaad9755ea
commit 71fab34c98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,6 +13,7 @@ import org.lsposed.lspatch.share.LSPConfig
import org.lsposed.patch.LSPatch
import org.lsposed.patch.util.Logger
import java.io.File
import java.util.*
class InjectShiggyXposedStep : Step() {
override val group: StepGroup = StepGroup.Install
@ -82,7 +83,15 @@ class InjectShiggyXposedStep : Step() {
// FilenameUtils.getBaseName(apkFileName),
// LSPConfig.instance.VERSION_CODE)
// )
val patchedApkName = "${baseName}-${LSPConfig.instance.VERSION_CODE}-lspatched.apk"
// Note: LSPatch uses Locale.getDefault() which can produce locale-specific numerals
// (e.g., Arabic numerals on Arabic locales). We must use Locale.US to ensure
// consistent filename matching regardless of device locale.
val patchedApkName = String.format(
Locale.US,
"%s-%d-lspatched.apk",
baseName,
LSPConfig.instance.VERSION_CODE
)
val patchedApk = File(tempDir, patchedApkName)
if (patchedApk.exists()) {