diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index ce45aeffe..1ae5ed31e 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -218,7 +218,7 @@ struct codec_name_pref_table codec_pref_table[]={ #pragma mark - Database Functions - (void)openDatabase { - /*NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath = [paths objectAtIndex:0]; NSString *databaseDocumentPath = [documentsPath stringByAppendingPathComponent:@"database.txt"]; @@ -229,6 +229,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]]; @@ -238,15 +242,15 @@ struct codec_name_pref_table codec_pref_table[]={ if(sqlite3_open([databaseDocumentPath UTF8String], &database) != SQLITE_OK) { [LinphoneLogger log:LinphoneLoggerError format:@"Can't open \"%@\" sqlite3 database.", databaseDocumentPath]; - }*/ + } } - (void)closeDatabase { - /*if(database != NULL) { + if(database != NULL) { if(sqlite3_close(database) != SQLITE_OK) { [LinphoneLogger logc:LinphoneLoggerError format:"Can't close sqlite3 database."]; } - }*/ + } } diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index cdf3ba110..19222f0af 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -1185,7 +1185,6 @@ D326483415887D4400930C67 /* Utils */ = { isa = PBXGroup; children = ( - D37CD35515E22B0C0028869A /* ZBarSDK */, D380801215C299D0005BE9BC /* ColorSpaceUtilites.m */, D380801115C29984005BE9BC /* ColorSpaceUtilities.h */, D32B9DFA15A2F131000B6DEC /* FastAddressBook.h */, @@ -1196,6 +1195,7 @@ D3F9A9EB15AF27620045320F /* UACellBackgroundView */, C9B3A6FD15B485DB006F52EE /* Utils.h */, D35860D515B549B500513429 /* Utils.m */, + D37CD35515E22B0C0028869A /* ZBarSDK */, ); name = Utils; sourceTree = "";