fixed indentation of SDLActivity.java
@@ -315,9 +315,8 @@ private void CopyPak(){
String version = null;
String toast = null;
- try{
version = context.getPackageManager().getPackageInfo(context.getPackageName(),0).versionName; //get version number as string
- } catch (Exception e) { }
+
//Toast.makeText(context,context.getPackageName().toString(), Toast.LENGTH_LONG).show();
File outFolder = new File(ctx.getExternalFilesDir(null) + "/Paks"); //set local output folder
File outFile = new File(outFolder, version + ".pak"); //set local output fileame as version number
@@ -335,25 +334,25 @@ private void CopyPak(){
//directory is empty
}
}
-
} else {
-
- if (outFolder.isDirectory() & !outFile.exists()) //if local folder true and file does not match version empty folder
- {
+ if (outFolder.isDirectory() & !outFile.exists()) { //if local folder true and file does not match version empty folder
toast = "Updating please wait!";
String[] children = outFolder.list();
- for (int i = 0; i < children.length; i++)
- {
+ for (int i = 0; i < children.length; i++) {
new File(outFolder, children[i]).delete();
}
- } else {toast = "First time setup please wait!";}
+ } else {
+ toast = "First time setup please wait!";
+ }
if(!outFile.exists()) {
Toast.makeText(context,toast, Toast.LENGTH_LONG).show();
outFolder.mkdirs();
+
int resId = context.getResources().getIdentifier("raw/bor", null, context.getPackageName());
InputStream in = getResources().openRawResource(resId);
FileOutputStream out = new FileOutputStream(outFile);
+
copyFile(in, out);
in.close();
in = null;
@@ -361,7 +360,12 @@ private void CopyPak(){
out.close();
out = null;
}
- }} catch (IOException e1) { }
+ }
+ } catch (IOException e) {
+ // not handled
+ } catch (Exception e) {
+ // not handled
+ }
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
