diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index b6a4364db..e926c1a17 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -243,6 +243,22 @@ public class GameUtils { return al.toArray( new String[al.size()] ); } + public static boolean dictExists( Context context, String name ) + { + boolean exists = dictIsBuiltin( context, name ); + if ( !exists ) { + name = addDictExtn( name ); + try { + FileInputStream fis = context.openFileInput( name ); + fis.close(); + exists = true; + } catch ( java.io.FileNotFoundException fnf ) { + } catch ( java.io.IOException ioe ) { + } + } + return exists; + } + public static boolean dictIsBuiltin( Context context, String name ) { boolean builtin = false; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java index 0e04a7b4b..42247b460 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java @@ -206,7 +206,7 @@ public class CommonPrefs { public static String getDefaultDict( Context context ) { String value = getString( context, R.string.key_default_dict ); - if ( value.equals("") ) { + if ( value.equals("") || !GameUtils.dictExists( context, value ) ) { value = GameUtils.dictList( context )[0]; } return value;