ROOM temp dir

pull/214/head
M66B 2 years ago
parent 715dd2c36a
commit aaafe78bef

@ -206,8 +206,8 @@ class SQLiteCopyOpenHelper implements SupportSQLiteOpenHelper, DelegatingOpenHel
// An intermediate file is used so that we never end up with a half-copied database file // An intermediate file is used so that we never end up with a half-copied database file
// in the internal directory. // in the internal directory.
File intermediateFile = File.createTempFile( File dir = eu.faircode.email.Helper.ensureExists(new File(mContext.getFilesDir(), "shared"));
"room-copy-helper", ".tmp", mContext.getCacheDir()); File intermediateFile = new File(dir,"room-copy-helper.tmp");
intermediateFile.deleteOnExit(); intermediateFile.deleteOnExit();
FileChannel output = new FileOutputStream(intermediateFile).getChannel(); FileChannel output = new FileOutputStream(intermediateFile).getChannel();
FileUtil.copy(input, output); FileUtil.copy(input, output);

@ -2633,7 +2633,7 @@ public class Helper {
private static final Map<File, Boolean> exists = new HashMap<>(); private static final Map<File, Boolean> exists = new HashMap<>();
static File ensureExists(File dir) { public static File ensureExists(File dir) {
synchronized (exists) { synchronized (exists) {
if (exists.containsKey(dir)) if (exists.containsKey(dir))
return dir; return dir;

Loading…
Cancel
Save