Fixed issue with _config.p not copying from assets
This commit is contained in:
parent
fa0a23450b
commit
461bfe0282
2 changed files with 22 additions and 2 deletions
|
@ -217,6 +217,9 @@ public class DownloadFileHelper {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (de.type == DownloadActivityType.VOICE_FILE){
|
||||
copyVoiceConfig(de);
|
||||
}
|
||||
toReIndex.add(de.targetFile);
|
||||
showWarningCallback.showWarning(ctx.getString(R.string.download_index_success));
|
||||
return true;
|
||||
|
@ -229,6 +232,23 @@ public class DownloadFileHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void copyVoiceConfig(DownloadEntry de) {
|
||||
File f = ctx.getAppPath("/voice/" + de.baseName + "/_config.p");
|
||||
if (f.exists()) try {
|
||||
InputStream is = ctx.getAssets().open("voice/" + de.baseName + "/config.p");
|
||||
int size = is.available();
|
||||
byte[] buffer = new byte[size];
|
||||
is.read(buffer);
|
||||
is.close();
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
fos.write(buffer);
|
||||
fos.close();
|
||||
} catch (Exception ex){
|
||||
log.debug(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void unzipFile(DownloadEntry de, IProgress progress, List<InputStream> is) throws IOException {
|
||||
CountingMultiInputStream fin = new CountingMultiInputStream(is);
|
||||
int len = (int) fin.available();
|
||||
|
|
|
@ -328,8 +328,8 @@ public class DownloadIndexesThread {
|
|||
boolean res = false;
|
||||
if (de.isAsset) {
|
||||
try {
|
||||
if (uiActivity != null) {
|
||||
ResourceManager.copyAssets(uiActivity.getAssets(), de.assetName, de.targetFile);
|
||||
if (ctx != null) {
|
||||
ResourceManager.copyAssets(ctx.getAssets(), de.assetName, de.targetFile);
|
||||
boolean changedDate = de.targetFile.setLastModified(de.dateModified);
|
||||
if(!changedDate) {
|
||||
log.error("Set last timestamp is not supported");
|
||||
|
|
Loading…
Reference in a new issue