Skip to content

Commit

Permalink
add cleanOptimizedDirectory method
Browse files Browse the repository at this point in the history
  • Loading branch information
cmzy committed Jan 5, 2016
1 parent 52ea0af commit c9a3c95
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* source_dir: /data/data/com.HOST.PACKAGE/Plugin/PLUGIN.PKG/apk/apk-1.apk
* 数据目录: /data/data/com.HOST.PACKAGE/Plugin/PLUGIN.PKG/data/PLUGIN.PKG
* dex缓存目录: /data/data/com.HOST.PACKAGE/Plugin/PLUGIN.PKG/dalvik-cache/
* <p/>
* <p>
* Created by Andy Zhang([email protected]) on 2015/2/5.
*/
public class PluginDirHelper {
Expand Down Expand Up @@ -126,4 +126,24 @@ public static String getContextDataDir(Context context) {
String dataDir = new File(Environment.getDataDirectory(), "data/").getPath();
return new File(dataDir, context.getPackageName()).getPath();
}

public static void cleanOptimizedDirectory(String optimizedDirectory) {
try {
File dir = new File(optimizedDirectory);
if (dir.exists() && dir.isDirectory()) {
File[] files = dir.listFiles();
if (files != null && files.length > 0) {
for (File f : files) {
f.delete();
}
}
}

if (dir.exists() && dir.isFile()) {
dir.delete();
dir.mkdirs();
}
} catch (Throwable e) {
}
}
}

0 comments on commit c9a3c95

Please sign in to comment.