mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 17:59:21 +00:00
add logs for remove item and move log file to dataPath
This commit is contained in:
parent
55027dbc82
commit
68860ba25f
4 changed files with 41 additions and 18 deletions
|
|
@ -373,17 +373,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
}
|
||||
|
||||
-(void) nsDataWrite:(NSData *)data {
|
||||
NSString* groupName = [NSString stringWithFormat:@"group.%@.linphoneExtension",[[NSBundle mainBundle] bundleIdentifier]];
|
||||
NSError *error = nil;
|
||||
NSString *path =[[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:groupName] path];
|
||||
NSString *fullCacheFilePathPath = [NSString stringWithFormat:@"%@/%@",path,@"nsData"];
|
||||
[[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:fullCacheFilePathPath] error:&error];
|
||||
if (![data writeToFile:fullCacheFilePathPath atomically:YES]) {
|
||||
NSLog(@"nsDataWrite error %@",error);
|
||||
}
|
||||
}
|
||||
|
||||
-(NSData *) nsDataRead {
|
||||
NSString* groupName = [NSString stringWithFormat:@"group.%@.linphoneExtension",[[NSBundle mainBundle] bundleIdentifier]];
|
||||
NSString *path =[[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:groupName] path];
|
||||
|
|
@ -1347,6 +1336,9 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
|
||||
+ (void)writeFileInCache:(NSData *)data name:(NSString *)name {
|
||||
NSString *filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:name];
|
||||
if (name || [name isEqualToString:@""]) {
|
||||
LOGW(@"try to write file in %@", filePath);
|
||||
}
|
||||
[[NSFileManager defaultManager] createFileAtPath:filePath
|
||||
contents:data
|
||||
attributes:nil];
|
||||
|
|
@ -1393,6 +1385,9 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
// get the url of localfile
|
||||
NSString *filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:fileName];
|
||||
NSURL *localURL = nil;
|
||||
if (fileName || [fileName isEqualToString:@""]) {
|
||||
LOGW(@"[writeFileInICloud] try to write file in %@", filePath);
|
||||
}
|
||||
if ([fileManager createFileAtPath:filePath contents:data attributes:nil]) {
|
||||
localURL = [NSURL fileURLWithPath:filePath];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1720,7 +1720,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
fileError ? fileError.localizedDescription : @"successfully");
|
||||
} else {
|
||||
[fileManager moveItemAtPath:src toPath:dst error:&fileError];
|
||||
LOGI(@"%@ moving to %@ %@", dst, src, fileError ? fileError.localizedDescription : @"successfully");
|
||||
LOGW(@"%@ moving to %@ %@", dst, src, fileError ? fileError.localizedDescription : @"successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1846,7 +1846,21 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
}
|
||||
|
||||
+ (NSString *)cacheDirectory {
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
NSURL *basePath = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:kLinphoneMsgNotificationAppGroupId];
|
||||
NSString *fullPath = [[basePath path] stringByAppendingString:@"/Library/Caches/"];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
||||
NSError *error;
|
||||
LOGW(@"Download path %@ does not exist, creating it.", fullPath);
|
||||
if (![[NSFileManager defaultManager] createDirectoryAtPath:fullPath
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&error]) {
|
||||
LOGE(@"Create download path directory error: %@", error.description);
|
||||
}
|
||||
}
|
||||
return fullPath;
|
||||
|
||||
/*LinphoneFactory *factory = linphone_factory_get();
|
||||
NSString *cachePath = [NSString stringWithUTF8String:linphone_factory_get_download_dir(factory, kLinphoneMsgNotificationAppGroupId.UTF8String)];
|
||||
BOOL isDir = NO;
|
||||
NSError *error;
|
||||
|
|
@ -1856,8 +1870,9 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
|
|||
withIntermediateDirectories:NO
|
||||
attributes:nil
|
||||
error:&error];
|
||||
LOGW(@"create new cache directory");
|
||||
}
|
||||
return cachePath;
|
||||
return cachePath;*/
|
||||
}
|
||||
|
||||
+ (NSString *)oldPreferenceFile:(NSString *)file {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,13 @@
|
|||
if ([encrptedFilePaths count] > 0) {
|
||||
for(NSString *path in [encrptedFilePaths allValues]) {
|
||||
if (![path isEqualToString:@""]) {
|
||||
LOGW(@"[vfs]s remove item at %@",path);
|
||||
if ([path isEqualToString:[LinphoneManager cacheDirectory]]) {
|
||||
LOGE(@"[vfs] something is wrong, can not delete the cache directory");
|
||||
break;
|
||||
}
|
||||
[[NSFileManager defaultManager] removeItemAtPath:path error:nil];
|
||||
|
||||
}
|
||||
}
|
||||
[LinphoneManager setValueInMessageAppData:NULL forKey:@"encryptedfiles" inMessage:_message];
|
||||
|
|
@ -85,9 +91,15 @@
|
|||
if (filePath) {
|
||||
if (![filePath isEqualToString:@""]) {
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
|
||||
if (error) {
|
||||
LOGI(@"clean failed %@", error.description);
|
||||
LOGW(@"[vfs] remove item at %@",filePath);
|
||||
if ([filePath isEqualToString:[LinphoneManager cacheDirectory]]) {
|
||||
LOGE(@"[vfs] something is wrong, can not delete the cache directory");
|
||||
} else {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
|
||||
|
||||
if (error) {
|
||||
LOGI(@"clean failed %@", error.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
[LinphoneManager setValueInMessageAppData:NULL forKey:@"encryptedfile" inMessage:_message];
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
asl_add_log_file(NULL, STDERR_FILENO);
|
||||
stderrInUse = YES;
|
||||
}
|
||||
linphone_core_set_log_collection_path([LinphoneManager cacheDirectory].UTF8String);
|
||||
LinphoneFactory *factory = linphone_factory_get();
|
||||
linphone_core_set_log_collection_path(linphone_factory_get_data_dir(factory, kLinphoneMsgNotificationAppGroupId.UTF8String));
|
||||
linphone_core_set_log_handler(linphone_iphone_log_handler);
|
||||
linphone_core_enable_log_collection(enabled);
|
||||
if (level == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue