Move sha256 with temporary file during update
app/src/main/java/eu/lepiller/nani/DictionaryDownloadService.java
255 | 255 | String uri = e.getKey(); | |
256 | 256 | File temporaryFile = e.getValue().first; | |
257 | 257 | File cacheFile = e.getValue().second; | |
258 | + | createParent(cacheFile); | |
258 | 259 | ||
259 | 260 | boolean newFile = downloadSha256(new URL(uri + ".sha256"), new File(temporaryFile + ".sha256")); | |
260 | 261 | if(newFile) { |
app/src/main/java/eu/lepiller/nani/dictionary/FileDictionary.java
95 | 95 | ||
96 | 96 | if(!getTemporaryFile().renameTo(getFile())) | |
97 | 97 | Log.w(TAG, getTemporaryFile() + " was not renamed to " + getFile() + " as expected."); | |
98 | + | ||
99 | + | File sha256 = new File(getFile() + ".sha256"); | |
100 | + | File sha256Temp = new File(getTemporaryFile() + ".sha256"); | |
101 | + | ||
102 | + | if(!sha256Temp.renameTo(sha256)) | |
103 | + | Log.w(TAG, sha256Temp + " was not renamed to " + sha256 + " as expected."); | |
98 | 104 | } | |
99 | 105 | } | |
100 | 106 |