fix HotReload helper to use proper paths consistently
This commit is contained in:
@@ -10,22 +10,14 @@ import android.util.Log
|
||||
class HotReloadPathHelper {
|
||||
companion object {
|
||||
fun getAssetPath(path: String, packageName: String): String? {
|
||||
// iterate over evr
|
||||
val shortName = packageName.split(".").last().split("_").last()
|
||||
val packagePath = "/data/user/0/${packageName}/code_cache/"
|
||||
Log.v("FFI", "Looking for shortName ${shortName} under package path ${packagePath}")
|
||||
val files = File(packagePath).listFiles().filter {
|
||||
it.path.split("/").last().startsWith(shortName)
|
||||
}.map {
|
||||
val f = File(it.path + "/${shortName}/build/${path}")
|
||||
Log.v("FFI", "Looking for ${f.path.toString()}")
|
||||
f
|
||||
}.filter {
|
||||
it.exists()
|
||||
Log.v("FFI", "Looking for path ${path} under package path ${packagePath}")
|
||||
val files = File(packagePath).walkBottomUp().filter {
|
||||
it.path.endsWith(path)
|
||||
}.sortedBy {
|
||||
Log.v("FFI", it.path.toString())
|
||||
it.lastModified()
|
||||
}
|
||||
}.toList()
|
||||
Log.v("FFI", files.size.toString())
|
||||
if(files.size > 0)
|
||||
return files.first().path;
|
||||
|
||||
Reference in New Issue
Block a user