Permalink
Browse files

If file upload op fails, we now try to recover by checking if the syn…

…c changes folder actually exists, and creating it if not. This situation did arise.
  • Loading branch information...
1 parent cd6dd84 commit ba682f9f77509a1174400a97fcd38747cd0707c1 @drewmccormack committed Feb 5, 2013
@@ -85,7 +85,12 @@ - (void)uploadLocalSyncChangeSetFileAtLocation:(NSURL *)aLocation
success = [self moveItemAtPath:[aLocation path] toPath:uploadPath error:&anyError];
if( !success ) {
- [self setError:[TICDSError errorWithCode:TICDSErrorCodeFileManagerError underlyingError:anyError classAndMethod:__PRETTY_FUNCTION__]];
+ // Check that the directory exists, and try to recover
+ if ( ![self fileExistsAtPath:self.thisDocumentSyncChangesThisClientDirectoryPath] ) {
+ [self createDirectoryAtPath:self.thisDocumentSyncChangesThisClientDirectoryPath withIntermediateDirectories:YES attributes:nil error:NULL];
+ success = [self moveItemAtPath:[aLocation path] toPath:uploadPath error:&anyError];
+ }
+ if ( !success ) [self setError:[TICDSError errorWithCode:TICDSErrorCodeFileManagerError underlyingError:anyError classAndMethod:__PRETTY_FUNCTION__]];
}
[self uploadedLocalSyncChangeSetFileSuccessfully:success];

0 comments on commit ba682f9

Please sign in to comment.