File tree Expand file tree Collapse file tree 1 file changed +8
-20
lines changed
firebase-installations/src/main/java/com/google/firebase/installations/local Expand file tree Collapse file tree 1 file changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -92,33 +92,21 @@ private File getDataFile() {
92
92
new File (
93
93
firebaseApp .getApplicationContext ().getNoBackupFilesDir (),
94
94
SETTINGS_FILE_NAME_PREFIX + "." + firebaseApp .getPersistenceKey () + ".json" );
95
- }
96
- }
97
- } else {
98
- synchronized (this ) {
99
- try {
100
- String noBackUpFilePath =
101
- firebaseApp .getApplicationContext ().getNoBackupFilesDir ().getCanonicalPath ();
102
- if (dataFile .getCanonicalPath ().startsWith (noBackUpFilePath )) {
95
+ if (dataFile .exists ()) {
103
96
return dataFile ;
104
- } else {
105
- // Move the file to the no back up directory.
106
- File dataFileNonBackup =
107
- new File (
108
- firebaseApp .getApplicationContext ().getNoBackupFilesDir (),
109
- SETTINGS_FILE_NAME_PREFIX + "." + firebaseApp .getPersistenceKey () + ".json" );
110
-
111
- if (!dataFile .renameTo (dataFileNonBackup )) {
97
+ }
98
+ File dataFileBackup =
99
+ new File (
100
+ firebaseApp .getApplicationContext ().getFilesDir (),
101
+ SETTINGS_FILE_NAME_PREFIX + "." + firebaseApp .getPersistenceKey () + ".json" );
102
+ if (dataFileBackup .exists ()) {
103
+ if (!dataFileBackup .renameTo (dataFile )) {
112
104
Log .e (
113
105
TAG ,
114
106
"Unable to move the file from back up to non back up directory" ,
115
107
new IOException ("Unable to move the file from back up to non back up directory" ));
116
- } else {
117
- dataFile = dataFileNonBackup ;
118
108
}
119
109
}
120
- } catch (IOException e ) {
121
- Log .e (TAG , "Error copying data file to non back up directory" , e );
122
110
}
123
111
}
124
112
}
You can’t perform that action at this time.
0 commit comments