File tree 1 file changed +22
-2
lines changed
parse/src/main/java/com/parse
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,17 @@ InstallationId installationId() {
178
178
File getCacheDir () {
179
179
synchronized (lock ) {
180
180
if (cacheDir == null ) {
181
- cacheDir = new File (applicationContext .getCacheDir (), "com.parse" );
181
+ /*
182
+ Check for old reference file before migration to v3.0.0.
183
+ If old reference found, copy the ref to new directory and delete the ref.
184
+ */
185
+ File oldRef = applicationContext .getDir ("Parse" , Context .MODE_PRIVATE );
186
+ if (oldRef .exists ()) {
187
+ cacheDir = new File (oldRef , "com.parse" );
188
+ oldRef .deleteOnExit ();
189
+ } else {
190
+ cacheDir = new File (applicationContext .getCacheDir (), "com.parse" );
191
+ }
182
192
}
183
193
return createFileDir (cacheDir );
184
194
}
@@ -187,7 +197,17 @@ File getCacheDir() {
187
197
File getFilesDir () {
188
198
synchronized (lock ) {
189
199
if (filesDir == null ) {
190
- filesDir = new File (applicationContext .getFilesDir (), "com.parse" );
200
+ /*
201
+ Check for old reference file before migration to v3.0.0.
202
+ If old reference found, copy the ref to new directory and delete the ref.
203
+ */
204
+ File oldRef = applicationContext .getDir ("Parse" , Context .MODE_PRIVATE );
205
+ if (oldRef .exists ()) {
206
+ filesDir = new File (oldRef , "com.parse" );
207
+ oldRef .deleteOnExit ();
208
+ } else {
209
+ filesDir = new File (applicationContext .getFilesDir (), "com.parse" );
210
+ }
191
211
}
192
212
return createFileDir (filesDir );
193
213
}
You can’t perform that action at this time.
0 commit comments