Fix database opening if original file doesn't exist

This commit is contained in:
Yann Diorcet 2012-08-20 11:13:10 +02:00
parent 22e828cace
commit eb96fdc9d3
3 changed files with 5 additions and 1 deletions

View file

@ -234,6 +234,10 @@ struct codec_name_pref_table codec_pref_table[]={
if ([fileManager fileExistsAtPath:databaseDocumentPath] == NO) {
[LinphoneLogger logc:LinphoneLoggerLog format:"Create sqlite3 database"];
NSString *resourceDocumentPath = [[NSBundle mainBundle] pathForResource:@"database" ofType:@"sqlite"];
if ([fileManager fileExistsAtPath:resourceDocumentPath] == NO) {
[LinphoneLogger log:LinphoneLoggerError format:@"Can't find original database: %@", [error localizedDescription]];
return;
}
[fileManager copyItemAtPath:resourceDocumentPath toPath:databaseDocumentPath error:&error];
if(error != nil) {
[LinphoneLogger log:LinphoneLoggerError format:@"Can't copy database: %@", [error localizedDescription]];

View file

@ -245,6 +245,7 @@
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
[self clearCache];
}

View file

@ -43,7 +43,6 @@
@private
UICompositeViewController *mainViewController;
UIActionSheet *incomingCallActionSheet;
UIActionSheet *batteryActionSheet;
int loadCount;