Skip to content

Commit

Permalink
Backup database if creating a new database with name of existing one.
Browse files Browse the repository at this point in the history
  • Loading branch information
helloworld1 committed Dec 15, 2014
1 parent 8498a92 commit e7b2134
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -431,8 +431,13 @@ public void onClick(DialogInterface dialog, int which ){
if(!value.endsWith(".db")){
value += ".db";
}
File newDbFile = new File(currentDirectory.getAbsolutePath() + "/" + value);
try {
amFileUtil.createDbFileWithDefaultSettings(new File(currentDirectory.getAbsolutePath() + "/" + value));
if (newDbFile.exists()) {
amFileUtil.deleteFileWithBackup(newDbFile.getAbsolutePath());
}

amFileUtil.createDbFileWithDefaultSettings(newDbFile);
} catch(IOException e){
Log.e(TAG, "Fail to create file", e);
}
Expand Down

0 comments on commit e7b2134

Please sign in to comment.