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:
parent
eaad9755ea
commit
71fab34c98
1 changed files with 10 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ import org.lsposed.lspatch.share.LSPConfig
|
||||||
import org.lsposed.patch.LSPatch
|
import org.lsposed.patch.LSPatch
|
||||||
import org.lsposed.patch.util.Logger
|
import org.lsposed.patch.util.Logger
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class InjectShiggyXposedStep : Step() {
|
class InjectShiggyXposedStep : Step() {
|
||||||
override val group: StepGroup = StepGroup.Install
|
override val group: StepGroup = StepGroup.Install
|
||||||
|
|
@ -82,7 +83,15 @@ class InjectShiggyXposedStep : Step() {
|
||||||
// FilenameUtils.getBaseName(apkFileName),
|
// FilenameUtils.getBaseName(apkFileName),
|
||||||
// LSPConfig.instance.VERSION_CODE)
|
// 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)
|
val patchedApk = File(tempDir, patchedApkName)
|
||||||
|
|
||||||
if (patchedApk.exists()) {
|
if (patchedApk.exists()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue