Skip to content

Commit

Permalink
fix extractV2RayAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Feb 15, 2023
1 parent e3b1f5f commit 553c576
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import libcore.Libcore
import org.json.JSONObject
import java.io.File
import java.io.FileNotFoundException
import java.io.FileWriter
import java.util.*
import java.util.concurrent.atomic.AtomicInteger

Expand Down Expand Up @@ -137,6 +138,10 @@ class AssetsActivity : ThemedActivity() {

File(outFile.parentFile, outFile.nameWithoutExtension + ".version.txt").apply {
if (isFile) delete()
createNewFile()
val fw = FileWriter(this)
fw.write("Custom")
fw.close()
}

adapter.reloadAssets()
Expand Down
14 changes: 9 additions & 5 deletions libcore/assets_android.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ func extractAssetName(name string, useOfficialAssets bool) error {
_ = os.RemoveAll(version)
} else {
localVersion = string(b)
av, err := strconv.ParseUint(assetVersion, 10, 64)
if err != nil {
doExtract = assetVersion != localVersion
if localVersion == "Custom" {
doExtract = false
} else {
lv, err := strconv.ParseUint(localVersion, 10, 64)
doExtract = err != nil || av > lv
av, err := strconv.ParseUint(assetVersion, 10, 64)
if err != nil {
doExtract = assetVersion != localVersion
} else {
lv, err := strconv.ParseUint(localVersion, 10, 64)
doExtract = err != nil || av > lv
}
}
}
} else {
Expand Down

0 comments on commit 553c576

Please sign in to comment.