diff --git a/ArqRestoreCommand.m b/ArqRestoreCommand.m index 669409f..957d982 100644 --- a/ArqRestoreCommand.m +++ b/ArqRestoreCommand.m @@ -238,6 +238,14 @@ return NO; } printf("restored files are in %s\n", [bucketName fileSystemRepresentation]); + NSDictionary *errorsByPath = [restorer errorsByPath]; + if ([errorsByPath count] > 0) { + printf("Errors occurred:\n"); + NSArray *sortedKeys = [[errorsByPath allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; + for (NSString *key in sortedKeys) { + printf("%s\t\t%s\n", [key UTF8String], [[[errorsByPath objectForKey:key] localizedDescription] UTF8String]); + } + } } return YES; } diff --git a/Restorer.h b/Restorer.h index ec1ea52..1442ced 100644 --- a/Restorer.h +++ b/Restorer.h @@ -56,4 +56,5 @@ } - (id)initWithRepo:(ArqRepo *)theRepo bucketName:(NSString *)theBucketName commitSHA1:(NSString *)theCommitSHA1; - (BOOL)restore:(NSError **)error; +- (NSDictionary *)errorsByPath; @end diff --git a/Restorer.m b/Restorer.m index 5163cbf..db6b348 100644 --- a/Restorer.m +++ b/Restorer.m @@ -75,6 +75,7 @@ - (BOOL)createSymLink:(Node *)node path:(NSString *)symLinkFile target:(NSString *)target error:(NSError **)error; - (BOOL)applyACLBlobKey:(BlobKey *)aclBlobKey uncompress:(BOOL)uncompress toPath:(NSString *)path error:(NSError **)error; - (BOOL)applyXAttrsBlobKey:(BlobKey *)xattrsBlobKey uncompress:(BOOL)uncompress toFile:(NSString *)path error:(NSError **)error; +- (void)addError:(NSError *)theError forPath:(NSString *)thePath; @end @implementation Restorer @@ -154,6 +155,9 @@ } return YES; } +- (NSDictionary *)errorsByPath { + return errorsByPath; +} @end @implementation Restorer (internal) @@ -203,7 +207,7 @@ } break; } - [self performSelectorOnMainThread:@selector(addError:) withObject:[NSArray arrayWithObjects:restoreError, childPath, nil] waitUntilDone:YES]; + [self addError:restoreError forPath:childPath]; } } else { NSError *restoreError = nil; @@ -216,7 +220,7 @@ break; } HSLogDebug(@"error restoring %@: %@", childPath, restoreError); - [self performSelectorOnMainThread:@selector(addError:) withObject:[NSArray arrayWithObjects:restoreError, childPath, nil] waitUntilDone:YES]; + [self addError:restoreError forPath:childPath]; } } } @@ -690,4 +694,7 @@ } return YES; } +- (void)addError:(NSError *)theError forPath:(NSString *)thePath { + [errorsByPath setObject:theError forKey:thePath]; +} @end