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

main
Jean Chalard 2011-08-10 21:54:27 -07:00 committed by Android (Google) Code Review
commit f102f6a3ac
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;