Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Develop #13

Closed
wants to merge 9 commits into from

2 participants

Michael Robinson Mike Abdullah
Commits on Sep 21, 2012
  1. Michael Robinson

    Minor to delegate method

    faceleg authored
  2. Michael Robinson
Commits on Sep 25, 2012
  1. Michael Robinson
  2. Michael Robinson
Commits on Oct 3, 2012
  1. Michael Robinson

    Updated createDirectoryAtPath

    faceleg authored
Commits on Oct 9, 2012
  1. Michael Robinson

    Merge remote-tracking branch 'origin/develop' into develop

    faceleg authored
    Conflicts:
    	CKConnectionProtocol.h
  2. Michael Robinson
  3. Michael Robinson

    Project

    faceleg authored
  4. Michael Robinson
This page is out of date. Refresh to see the latest.
4 CKConnectionProtocol.h
View
@@ -268,7 +268,7 @@ typedef enum {
#pragma mark Other
- (void)connection:(id <CKPublishingConnection>)con didCreateDirectory:(NSString *)dirPath error:(NSError *)error;
-- (void)connection:(id <CKConnection>)con didDeleteDirectory:(NSString *)dirPath error:(NSError *)error;
+- (void)connection:(id <CKPublishingConnection>)con didDeleteDirectory:(NSString *)dirPath error:(NSError *)error;
- (void)connection:(id <CKPublishingConnection>)con didDeleteFile:(NSString *)path error:(NSError *)error;
@@ -283,7 +283,7 @@ typedef enum {
- (void)connection:(id <CKPublishingConnection>)con didChangeToDirectory:(NSString *)dirPath error:(NSError *)error;
- (void)connection:(id <CKPublishingConnection>)con didReceiveContents:(NSArray *)contents ofDirectory:(NSString *)dirPath error:(NSError *)error;
- (void)connection:(id <CKConnection>)con didReceiveContents:(NSArray *)contents ofDirectory:(NSString *)dirPath moreComing:(BOOL)flag;
-- (void)connection:(id <CKConnection>)con didRename:(NSString *)fromPath to:(NSString *)toPath error:(NSError *)error;
+- (void)connection:(id <CKPublishingConnection>)con didRename:(NSString *)fromPath to:(NSString *)toPath error:(NSError *)error;
- (void)connection:(id <CKPublishingConnection>)con didSetPermissionsForFile:(NSString *)path error:(NSError *)error;
108 CKCurlFTPConnection.m
View
@@ -238,11 +238,18 @@ - (void)threaded_writeData:(NSData *)data toPath:(NSString *)path transferRecord
- (void)createDirectoryAtPath:(NSString *)path posixPermissions:(NSNumber *)permissions;
{
- NSInvocation *invocation = [NSInvocation invocationWithSelector:@selector(threaded_createDirectoryAtPath:permissions:)
- target:self
- arguments:[NSArray arrayWithObjects:path, permissions, nil]];
+ path = [self canonicalPathForPath:path];
+
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
+ [self methodSignatureForSelector:@selector(threaded_createDirectoryAtPath:permissions:)]];
+ [invocation setTarget:self];
+ [invocation setSelector:@selector(threaded_createDirectoryAtPath:permissions:)];
+ [invocation setArgument:&path atIndex:2];
+ [invocation setArgument:&permissions atIndex:3];
+ [invocation retainArguments];
+
+ NSOperation *op = [[NSInvocationOperation alloc] initWithInvocation:invocation];
- NSInvocationOperation *op = [[NSInvocationOperation alloc] initWithInvocation:invocation];
[self enqueueOperation:op];
[op release];
}
@@ -314,16 +321,71 @@ - (void)threaded_removeFileAtPath:(NSString *)path;
[proxy release];
}
-- (void)directoryContents
-{
- NSOperation *op = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(threaded_directoryContents:) object:[self currentDirectory]];
+- (void) deleteDirectory:(NSString *)path
+{
+ path = [self canonicalPathForPath:path];
+
+ NSOperation *op = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(threaded_removeDirectoryAtPath:) object:path];
[self enqueueOperation:op];
[op release];
}
+
+- (void)threaded_removeDirectoryAtPath:(NSString *)path
+{
+ NSError *error;
+ BOOL result = [_session removeDirectoryAtPath:path error:&error];
+ if (result) error = nil;
+
+ id proxy = [[UKMainThreadProxy alloc] initWithTarget:[self delegate]];
+ [proxy connection:self didDeleteDirectory:path error:error];
+ [proxy release];
+}
+
+- (void)rename:(NSString *)fromPath to:(NSString *)toPath
+{
+ fromPath = [self canonicalPathForPath:fromPath];
+ toPath = [self canonicalPathForPath:toPath];
+
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
+ [self methodSignatureForSelector:@selector(threaded_rename:to:)]];
+ [invocation setTarget:self];
+ [invocation setSelector:@selector(threaded_rename:to:)];
+ [invocation setArgument:&fromPath atIndex:2];
+ [invocation setArgument:&toPath atIndex:3];
+ [invocation retainArguments];
+
+ NSOperation *op = [[NSInvocationOperation alloc] initWithInvocation:invocation];
+ [self enqueueOperation:op];
+ [op release];
+}
+
+- (void)threaded_rename:(NSString *)fromPath to:(NSString *)toPath
+{
+ NSError *error;
+
+ BOOL result = [_session renameItem:fromPath toPath:toPath error:&error];
+ if (result) error = nil;
+
+ id proxy = [[UKMainThreadProxy alloc] initWithTarget:[self delegate]];
+ [proxy connection:self didRename:fromPath to:toPath error:error];
+ [proxy release];
+}
+
+
+- (void) contentsOfDirectory:(NSString *)directory {
+ NSOperation *op = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(threaded_directoryContents:) object:directory];
+ [self enqueueOperation:op];
+ [op release];
+
+}
+
+- (void)directoryContents
+{
+ [self contentsOfDirectory:[self currentDirectory]];
+}
- (void)threaded_directoryContents:(NSString *)path;
{
NSMutableArray *result = [[NSMutableArray alloc] init];
-
NSError *error;
BOOL success = [_session enumerateContentsOfDirectoryAtPath:path error:&error usingBlock:^(NSDictionary *parsedResourceListing) {
@@ -351,12 +413,20 @@ - (void)threaded_directoryContents:(NSString *)path;
break;
}
- NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:
- [parsedResourceListing objectForKey:(NSString *)kCFFTPResourceName], cxFilenameKey,
- type, NSFileType,
- nil];
- [result addObject:attributes];
- [attributes release];
+ // Do not add . and .. entries
+ if (![[parsedResourceListing objectForKey:(NSString *)kCFFTPResourceName] isEqualToString:@"."]
+ && ![[parsedResourceListing objectForKey:(NSString *)kCFFTPResourceName] isEqualToString:@".."]) {
+ NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:
+ [parsedResourceListing objectForKey:(NSString *)kCFFTPResourceName], cxFilenameKey,
+ type, NSFileType,
+ [parsedResourceListing objectForKey:(NSString *)kCFFTPResourceModDate], NSFileModificationDate,
+ [parsedResourceListing objectForKey:(NSString *)kCFFTPResourceMode], NSFilePosixPermissions,
+ [parsedResourceListing objectForKey:(NSString *)kCFFTPResourceSize], NSFileSize,
+ nil];
+ [result addObject:attributes];
+ [attributes release];
+ }
+
}];
if (success)
@@ -406,11 +476,13 @@ - (void)cleanupConnection { }
- (void)FTPSession:(CURLFTPSession *)session didReceiveDebugInfo:(NSString *)string ofType:(curl_infotype)type;
{
- if (![self delegate]) return;
+ // Contents commented because of an error thrown when deleting a directory. Had no time to debug, don't need this debug information right now.
- id proxy = [[UKMainThreadProxy alloc] initWithTarget:[self delegate]];
- [proxy connection:self appendString:string toTranscript:(type == CURLINFO_HEADER_IN ? CKTranscriptReceived : CKTranscriptSent)];
- [proxy release];
+// if (![self delegate]) return;
+
+// id proxy = [[UKMainThreadProxy alloc] initWithTarget:[self delegate]];
+// [proxy connection:self appendString:string toTranscript:(type == CURLINFO_HEADER_IN ? CKTranscriptReceived : CKTranscriptSent)];
+// [proxy release];
}
@end
6 Connection.xcodeproj/project.pbxproj
View
@@ -50,7 +50,7 @@
278B06090EFA7EAB0093B23D /* CKURLProtectionSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = 278B06070EFA7EAB0093B23D /* CKURLProtectionSpace.m */; };
27AE68390EE98A8400409D80 /* CKConnectionRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 27AE68370EE98A8400409D80 /* CKConnectionRegistry.h */; settings = {ATTRIBUTES = (Public, ); }; };
27AE683A0EE98A8400409D80 /* CKConnectionRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 27AE68380EE98A8400409D80 /* CKConnectionRegistry.m */; };
- 27BFFED815027F0A00EFA319 /* CKCurlFTPConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 27BFFED615027F0A00EFA319 /* CKCurlFTPConnection.h */; };
+ 27BFFED815027F0A00EFA319 /* CKCurlFTPConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 27BFFED615027F0A00EFA319 /* CKCurlFTPConnection.h */; settings = {ATTRIBUTES = (Public, ); }; };
27BFFEE315027F7000EFA319 /* CURLHandle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27BFFEE215027F4200EFA319 /* CURLHandle.framework */; };
27D03B421471787000FEA588 /* CKUploader.h in Headers */ = {isa = PBXBuildFile; fileRef = 27D03B401471787000FEA588 /* CKUploader.h */; settings = {ATTRIBUTES = (Public, ); }; };
27D03B431471787000FEA588 /* CKUploader.m in Sources */ = {isa = PBXBuildFile; fileRef = 27D03B411471787000FEA588 /* CKUploader.m */; };
@@ -800,6 +800,7 @@
27D03B421471787000FEA588 /* CKUploader.h in Headers */,
79420AD40C91CDE80002B99D /* NSNumber+Connection.h in Headers */,
D3F21D980D14BB2900B1BADD /* EMKeychainProxy.h in Headers */,
+ 27BFFED815027F0A00EFA319 /* CKCurlFTPConnection.h in Headers */,
D3F21E870D14D0DD00B1BADD /* EMKeychainItem.h in Headers */,
27F6AF020EE95F1200B3BDB3 /* NSURL+Connection.h in Headers */,
27AE68390EE98A8400409D80 /* CKConnectionRegistry.h in Headers */,
@@ -812,7 +813,6 @@
2702E3FA1459CBB10085BBC4 /* libssh2_publickey.h in Headers */,
2702E3FB1459CBB10085BBC4 /* libssh2_sftp.h in Headers */,
2702E3FC1459CBB10085BBC4 /* libssh2.h in Headers */,
- 27BFFED815027F0A00EFA319 /* CKCurlFTPConnection.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1484,7 +1484,7 @@
79A8578E0B9267CA00D9C844 /* Plugin */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
Something went wrong with that request. Please try again.