Give the orders to delete the source files to the dict pack

Bug: 5095140
Change-Id: I64552861768ca30073ffe0d631b2e0c44dad4aa9
main
Jean Chalard 2011-08-10 18:57:01 +09:00
parent d4c08d9be3
commit 5774908bb3
1 changed files with 6 additions and 2 deletions

View File

@ -168,13 +168,17 @@ public class BinaryDictionaryFileDumper {
final List<String> idList = getDictIdList(locale, context);
final List<AssetFileAddress> fileAddressList = new ArrayList<AssetFileAddress>();
for (String id : idList) {
final Uri dictionaryPackUri = getProviderUri(id);
final Uri wordListUri = getProviderUri(id);
final AssetFileDescriptor afd =
resolver.openAssetFileDescriptor(dictionaryPackUri, "r");
resolver.openAssetFileDescriptor(wordListUri, "r");
if (null == afd) continue;
final String fileName = copyFileTo(afd.createInputStream(),
getCacheFileName(id, locale, context));
afd.close();
if (0 >= resolver.delete(wordListUri, null, null)) {
// I'd rather not print the word list ID to the log here out of security concerns
Log.e(TAG, "Could not have the dictionary pack delete a word list");
}
fileAddressList.add(AssetFileAddress.makeFromFileName(fileName));
}
return fileAddressList;