show an error Toast when db file export fails

Right now I seem to be writing it someplace I'm not supposed to
This commit is contained in:
Eric House 2022-06-06 20:21:50 -07:00
parent 3dea7bd205
commit 58680980e2
3 changed files with 13 additions and 8 deletions

View file

@ -1851,14 +1851,14 @@ public class DBUtils {
}
}
public static void loadDB( Context context )
public static boolean loadDB( Context context )
{
copyGameDB( context, false );
return copyGameDB( context, false );
}
public static void saveDB( Context context )
public static boolean saveDB( Context context )
{
copyGameDB( context, true );
return copyGameDB( context, true );
}
public static boolean copyFileStream( FileOutputStream fos,
@ -2443,8 +2443,9 @@ public class DBUtils {
}
}
private static void copyGameDB( Context context, boolean toSDCard )
private static boolean copyGameDB( Context context, boolean toSDCard )
{
boolean success = false;
String name = DBHelper.getDBName();
File gamesDB = context.getDatabasePath( name );
@ -2465,10 +2466,12 @@ public class DBUtils {
new FileOutputStream( toSDCard? sdcardDB : gamesDB );
copyFileStream( dest, src );
invalGroupsCache();
success = true;
}
} catch( java.io.FileNotFoundException fnfe ) {
Log.ex( TAG, fnfe );
}
return success;
}
// Copy my .apk to the Downloads directory, from which a user could more

View file

@ -1529,8 +1529,9 @@ public class GamesListDelegate extends ListDelegateBase
storeGroupPositions( null );
mkListAdapter();
} else if ( R.id.games_menu_storedb == id ) {
DBUtils.saveDB( m_activity );
showToast( R.string.db_store_done );
int msgID = DBUtils.saveDB( m_activity )
? R.string.db_store_done : R.string.db_store_failed;
showToast( msgID );
}
break;

View file

@ -2307,7 +2307,8 @@
<string name="pref_item_update_summary">Get intermediate builds</string>
<string name="checking_title">Checking</string>
<string name="checking_for_fmt">Checking for wordlists in %1$s…</string>
<string name="db_store_done">SD card write complete.</string>
<string name="db_store_done">SD card write complete</string>
<string name="db_store_failed">SD card write failed</string>
<string name="confirm_drop_mqtt">Are you sure you want to drop this
games ability to communicate via the internet?</string>
<string name="confirm_drop_relay_bt">Bluetooth only works for nearby