Skip to content

Commit a692243

Browse files
committed
create the dex and odex dirs if not exists
don't try to purge not existing proxies dir
1 parent 68d84eb commit a692243

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/src/com/tns/DexFactory.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ public DexFactory(Context context)
4646
this.proxyGenerator = new ProxyGenerator(dexPath);
4747
ProxyGenerator.IsLogEnabled = Platform.IsLogEnabled;
4848

49-
File odexDir = new File(this.odexPath);
50-
odexDir.mkdirs();
49+
File dexDir = new File(dexPath);
50+
51+
if (!dexDir.exists())
52+
{
53+
dexDir.mkdirs();
54+
}
55+
56+
File odexDir = new File(odexPath);
57+
if (!odexDir.exists())
58+
{
59+
odexDir.mkdir();
60+
}
5161

5262
this.updateDexThumbAndPurgeCache();
5363
this.proxyGenerator.setProxyThumb(this.dexThumb);
@@ -296,9 +306,15 @@ private String generateDexThumb()
296306

297307
private void purgeDexesByThumb(String cachedDexThumb, File pathToPurge)
298308
{
299-
if (!pathToPurge.isDirectory())
309+
if (!pathToPurge.exists())
310+
{
311+
return;
312+
}
313+
314+
if (!pathToPurge.isDirectory())
300315
{
301-
throw new RuntimeException("Purge path not a directory");
316+
Log.e(Platform.DEFAULT_LOG_TAG, "Purge proxies path not a directory. Path: " + pathToPurge);
317+
throw new RuntimeException("Purge path not a directory");
302318
}
303319

304320
String[] children = pathToPurge.list();

0 commit comments

Comments
 (0)