Loading java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +7 −1 Original line number Diff line number Diff line Loading @@ -72,10 +72,16 @@ final class BinaryDictionaryGetter { public static String getTempFileName(final String id, final Context context) throws IOException { final String safeId = DictionaryInfoUtils.replaceFileNameDangerousCharacters(id); final File directory = new File(DictionaryInfoUtils.getWordListTempDirectory(context)); if (!directory.exists()) { if (!directory.mkdirs()) { Log.e(TAG, "Could not create the temporary directory"); } } // If the first argument is less than three chars, createTempFile throws a // RuntimeException. We don't really care about what name we get, so just // put a three-chars prefix makes us safe. return File.createTempFile("xxx" + safeId, null).getAbsolutePath(); return File.createTempFile("xxx" + safeId, null, directory).getAbsolutePath(); } /** Loading java/src/com/android/inputmethod/latin/DictionaryInfoUtils.java +7 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,13 @@ public class DictionaryInfoUtils { return context.getFilesDir() + File.separator + "dicts"; } /** * Helper method to get the top level temp directory. */ public static String getWordListTempDirectory(final Context context) { return context.getFilesDir() + File.separator + "tmp"; } /** * Reverse escaping done by replaceFileNameDangerousCharacters. */ Loading Loading
java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +7 −1 Original line number Diff line number Diff line Loading @@ -72,10 +72,16 @@ final class BinaryDictionaryGetter { public static String getTempFileName(final String id, final Context context) throws IOException { final String safeId = DictionaryInfoUtils.replaceFileNameDangerousCharacters(id); final File directory = new File(DictionaryInfoUtils.getWordListTempDirectory(context)); if (!directory.exists()) { if (!directory.mkdirs()) { Log.e(TAG, "Could not create the temporary directory"); } } // If the first argument is less than three chars, createTempFile throws a // RuntimeException. We don't really care about what name we get, so just // put a three-chars prefix makes us safe. return File.createTempFile("xxx" + safeId, null).getAbsolutePath(); return File.createTempFile("xxx" + safeId, null, directory).getAbsolutePath(); } /** Loading
java/src/com/android/inputmethod/latin/DictionaryInfoUtils.java +7 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,13 @@ public class DictionaryInfoUtils { return context.getFilesDir() + File.separator + "dicts"; } /** * Helper method to get the top level temp directory. */ public static String getWordListTempDirectory(final Context context) { return context.getFilesDir() + File.separator + "tmp"; } /** * Reverse escaping done by replaceFileNameDangerousCharacters. */ Loading