mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
save phony "new game" even if names not set
This commit is contained in:
parent
cf60be5082
commit
b2f0b91a23
1 changed files with 26 additions and 27 deletions
|
@ -1,3 +1,5 @@
|
|||
/* -*- compile-command: "cd ../../../../../; ant reinstall"; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
*
|
||||
|
@ -136,39 +138,36 @@ public class GameConfig extends Activity implements View.OnClickListener {
|
|||
text = et.getText();
|
||||
String name2 = text.toString();
|
||||
|
||||
if ( name1.length() > 0 && name2.length() > 0 ) {
|
||||
Integer num = 0;
|
||||
int ii;
|
||||
String[] files = fileList();
|
||||
String name = null;
|
||||
Integer num = 0;
|
||||
int ii;
|
||||
String[] files = fileList();
|
||||
String name = null;
|
||||
|
||||
while ( name == null ) {
|
||||
name = "game " + num.toString();
|
||||
for ( ii = 0; ii < files.length; ++ii ) {
|
||||
Utils.logf( "comparing " + name + " with " + files[ii] );
|
||||
if ( files[ii].equals(name) ) {
|
||||
++num;
|
||||
name = null;
|
||||
}
|
||||
while ( name == null ) {
|
||||
name = "game " + num.toString();
|
||||
for ( ii = 0; ii < files.length; ++ii ) {
|
||||
Utils.logf( "comparing " + name + " with " + files[ii] );
|
||||
if ( files[ii].equals(name) ) {
|
||||
++num;
|
||||
name = null;
|
||||
}
|
||||
}
|
||||
Utils.logf( "using name " + name );
|
||||
}
|
||||
|
||||
FileOutputStream out;
|
||||
FileOutputStream out;
|
||||
try {
|
||||
out = openFileOutput( name, MODE_PRIVATE );
|
||||
PrintStream ps = new PrintStream( out );
|
||||
ps.println( name1 );
|
||||
ps.println( name2 );
|
||||
ps.close();
|
||||
try {
|
||||
out = openFileOutput( name, MODE_PRIVATE );
|
||||
PrintStream ps = new PrintStream( out );
|
||||
ps.println( name1 );
|
||||
ps.println( name2 );
|
||||
ps.close();
|
||||
try {
|
||||
out.close();
|
||||
} catch ( java.io.IOException ex ) {
|
||||
Utils.logf( "got IOException: " + ex.toString() );
|
||||
}
|
||||
} catch ( java.io.FileNotFoundException ex ) {
|
||||
Utils.logf( "got FileNotFoundException: " + ex.toString() );
|
||||
out.close();
|
||||
} catch ( java.io.IOException ex ) {
|
||||
Utils.logf( "got IOException: " + ex.toString() );
|
||||
}
|
||||
} catch ( java.io.FileNotFoundException ex ) {
|
||||
Utils.logf( "got FileNotFoundException: " + ex.toString() );
|
||||
}
|
||||
|
||||
setResult( 1 );
|
||||
|
|
Loading…
Add table
Reference in a new issue