1
0
mirror of https://github.com/PurpleI2P/i2pd-android.git synced 2025-01-08 22:07:57 +00:00

fix assets unpack when not required

Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
R4SAS 2022-04-06 22:24:42 +03:00
parent 67fb27a6ce
commit f363c10040
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2

View File

@ -203,13 +203,10 @@ public class DaemonWrapper {
}
private void processAssets() {
if (!assetsCopied) {
try {
assetsCopied = true;
File holderFile = new File(i2pdpath, "assets.ready");
String versionName = BuildConfig.VERSION_NAME; // here will be app version, like 2.XX.XX
StringBuilder text = new StringBuilder();
Log.d(TAG, "checking assets");
if (holderFile.exists()) {
try { // if holder file exists, read assets version string
@ -244,17 +241,13 @@ public class DaemonWrapper {
}
// if version differs from current app version or null, try to delete certificates folder
if (!text.toString().contains(versionName))
if (!text.toString().contains(versionName)) {
try {
boolean deleteResult = holderFile.delete();
if (!deleteResult)
Log.e(TAG, "holderFile.delete() returned " + deleteResult + ", absolute path='" + holderFile.getAbsolutePath() + "'");
File certPath = new File(i2pdpath, "certificates");
deleteRecursive(certPath);
}
catch (Throwable tr) {
Log.e(TAG, "", tr);
}
// copy assets. If processed file exists, it won't be overwritten
copyAsset("addressbook");
@ -309,7 +302,7 @@ public class DaemonWrapper {
// Make the directory.
File dir = new File(i2pdpath, path);
boolean result = dir.mkdirs();
Log.d(TAG, "dir.mkdirs() returned " + result);
Log.d(TAG, "dir.mkdirs() returned " + result + " for " + dir);
// Recurse on the contents.
for (String entry : contents) {