Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ZipResourceFile getObbFile() {
- if (null == sOBBFile) {
- int versionCode = 1;
- try {
- versionCode = Cocos2dxActivity.getContext().getPackageManager().getPackageInfo(Cocos2dxHelper.getCocos2dxPackageName(), 0).versionCode;
- } catch (NameNotFoundException e) {
- e.printStackTrace();
- }
- try {
- String pathToOBB = sActivity.getObbDir().toString();
- String[] fileNames = new File(pathToOBB).list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.startsWith("main.") && name.endsWith(".obb");
- }
- });
- if (fileNames.length > 0) {
- versionCode = Integer.parseInt(fileNames[0].split("\\.")[1]);
- }
- sOBBFile = APKExpansionSupport.getAPKExpansionZipFile(Cocos2dxActivity.getContext(), versionCode, 0);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return sOBBFile;
- }
Add Comment
Please, Sign In to add comment