@@ -73,7 +73,7 @@ private void initUI() {
7373 if (mSdCardAppDir .exists () && mSdCardAppDir .isDirectory ()) {
7474 File include = new File (mSdCardAppDir , "/SDL/include" );
7575 File lib = new File (mSdCardAppDir , "/SDL/lib" );
76- if (!include .exists () || !lib .exists ()) {
76+ if (!include .exists () || !lib .exists () || true ) {
7777 new InstallDevFilesTask ().execute ();
7878 } else {
7979 aboutDialog (1 );
@@ -129,6 +129,14 @@ public void onCancel(DialogInterface dialog) {
129129 .show ();
130130 }
131131
132+ @ Override
133+ protected void onDestroy () {
134+ if (mProgressDialog != null && mProgressDialog .isShowing ()) {
135+ mProgressDialog .dismiss ();
136+ }
137+ super .onDestroy ();
138+ }
139+
132140 @ SuppressLint ("StaticFieldLeak" )
133141 private class InstallDevFilesTask extends AsyncTask <Void , String , Void > {
134142 @ Override
@@ -150,33 +158,30 @@ protected Void doInBackground(Void... params) {
150158 try {
151159 File sdlDir = new File (mSdCardAppDir , "SDL" );
152160 File libDir = new File (sdlDir , "/SDL/lib" );
153- if (!libDir .exists ()) {
154- libDir .mkdirs ();
155- Utils .copyDirectory (new File (getCacheDir ().getParentFile ().getAbsolutePath () + "/lib" ), libDir );
156- new File (libDir , "libmain.so" ).delete ();
157- new File (libDir , "libccsdlplugin.so" ).delete ();
158- String arch = Build .CPU_ABI ;
159- if (arch .startsWith ("mips" )) {
160- arch = "mips" ;
161- }
162- publishProgress (getString (R .string .update_install_libs ));
163- InputStream is = getAssets ().open ("sdlmain-" + arch + ".zip" );
164- Utils .unpackZip (is , libDir .getAbsolutePath ());
165- is .close ();
166- }
167- if (!(new File (sdlDir , "include" ).exists ())) {
168- publishProgress (getString (R .string .update_install_headers ));
169- InputStream is = getAssets ().open ("headers.zip" );
170- Utils .unpackZip (is , sdlDir .getAbsolutePath ());
171- is .close ();
172- }
173- if (!(new File (mSdCardAppDir , "Examples/SDL" ).exists ())) {
174- publishProgress (getString (R .string .update_install_examples ));
175- InputStream is = getAssets ().open ("examples.zip" );
176- Utils .unpackZip (is , mSdCardAppDir .getAbsolutePath ());
177- is .close ();
161+ libDir .mkdirs ();
162+ Utils .copyDirectory (new File (getCacheDir ().getParentFile ().getAbsolutePath () + "/lib" ), libDir );
163+ new File (libDir , "libmain.so" ).delete ();
164+ new File (libDir , "libccsdlplugin.so" ).delete ();
165+ String arch = Build .CPU_ABI ;
166+ if (arch .startsWith ("mips" )) {
167+ arch = "mips" ;
178168 }
169+ publishProgress (getString (R .string .update_install_libs ));
170+ InputStream is = getAssets ().open ("sdlmain-" + arch + ".zip" );
171+ Utils .unpackZip (is , libDir .getAbsolutePath ());
172+ is .close ();
173+
174+ publishProgress (getString (R .string .update_install_headers ));
175+ is = getAssets ().open ("headers.zip" );
176+ Utils .unpackZip (is , sdlDir .getAbsolutePath ());
177+ is .close ();
178+
179+ publishProgress (getString (R .string .update_install_examples ));
180+ is = getAssets ().open ("examples.zip" );
181+ Utils .unpackZip (is , mSdCardAppDir .getAbsolutePath ());
182+ is .close ();
179183 } catch (IOException e ) {
184+ e .printStackTrace ();
180185 Log .e (TAG , "Error installing dev files " + e );
181186 }
182187 return null ;
@@ -189,5 +194,4 @@ protected void onPostExecute(Void result) {
189194 aboutDialog (1 );
190195 }
191196 }
192-
193197}
0 commit comments