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:
@@ -33,7 +33,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz )
|
||||
char curdir[512];
|
||||
if( isSdcardUsed )
|
||||
{
|
||||
strcpy(curdir, "/sdcard");
|
||||
strcpy(curdir, "/sdcard/");
|
||||
strcat(curdir, SDL_CURDIR_PATH);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#if defined(__WIN32__) || \
|
||||
(defined(__MWERKS__) && !defined(__BEOS__)) || \
|
||||
defined(__MACOS__) || defined(__MACOSX__) || \
|
||||
defined(__SYMBIAN32__) || defined(QWS)
|
||||
defined(__SYMBIAN32__) || defined(QWS) || defined(ANDROID)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
|
||||
@@ -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("[|]");
|
||||
|
||||
Reference in New Issue
Block a user