Fixed crashing when downloading data to SD card, fixed crashing when running SDL 1.2 app on Android 1.6 device

This commit is contained in:
pelya
2010-07-26 13:12:00 +03:00
parent 7580d9ff0f
commit b95831357b
3 changed files with 5 additions and 14 deletions

View File

@@ -135,7 +135,7 @@ class DataDownloader extends Thread
Status.setText( "Connecting to " + Globals.DataDownloadUrl );
outFilesDir = Parent.getFilesDir().getAbsolutePath();
if( Globals.DownloadToSdcard )
outFilesDir = "/sdcard/" + Globals.ApplicationName;
outFilesDir = "/sdcard/" + Globals.class.getPackage().getName();
this.start();
}
@@ -176,22 +176,13 @@ class DataDownloader extends Thread
}
checkFile = null;
// Create output directory
// Create output directory (not necessary for phone storage)
if( Globals.DownloadToSdcard )
{
try {
(new File( "/sdcard/" + Globals.ApplicationName )).mkdirs();
(new File( outFilesDir )).mkdirs();
} catch( SecurityException e ) { };
}
else
{
try {
FileOutputStream dummy = Parent.openFileOutput( "dummy", Parent.MODE_WORLD_READABLE );
dummy.write(0);
dummy.flush();
} catch( FileNotFoundException e ) {
} catch( java.io.IOException e ) {};
}
HttpResponse response = null;
String [] downloadUrls = Globals.DataDownloadUrl.split("[|]");