Revision 9990166e

b/pithos-macos/HashMapHash.m
93 93
+ (NSArray *)calculateObjectHashMap:(NSString *)filePath withBlockHash:(NSString *)blockHash andBlockSize:(NSUInteger)blockSize {
94 94
    NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:filePath];
95 95
    if (!fileHandle) {
96
        NSLog(@"HashMapHash failed to open file: %@", filePath);
96
        DLog(@"HashMapHash failed to open file: %@", filePath);
97 97
        return nil;
98 98
    }
99 99
    
b/pithos-macos/PithosAccount.m
399 399
    self.serverURL = aServerURL;
400 400
    self.authUser = anAuthUser;
401 401
    self.authToken = anAuthToken;
402
    NSLog(@"Account: %@\nauthentication", self);
402
    DLog(@"Account: %@\nauthentication", self);
403 403
    if (![authUser length] || ![authToken length]) {
404 404
        self.active = NO;
405 405
        self.syncActive = NO;
......
430 430
    NSProcessInfo *processInfo = [NSProcessInfo processInfo];
431 431
    NSString *loginURL = [NSString stringWithFormat:@"%@?next=pithos://%d/%@&force=", 
432 432
                          self.loginURLPrefix, [processInfo processIdentifier], self.name];
433
    NSLog(@"Account: %@\nloginURL: %@", self, loginURL);
433
    DLog(@"Account: %@\nloginURL: %@", self, loginURL);
434 434
    [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:loginURL]];
435 435
}
436 436

  
b/pithos-macos/PithosAccountNode.m
222 222

  
223 223
- (void)accountRequestFinished:(ASIPithosAccountRequest *)request {
224 224
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
225
    NSLog(@"List account finished: %@", [accountRequest url]);
226
    NSLog(@"Cached: %d", [accountRequest didUseCachedResponse]);
225
    DLog(@"List account finished: %@", [accountRequest url]);
226
    DLog(@"Cached: %d", [accountRequest didUseCachedResponse]);
227 227
    if (accountRequest.responseStatusCode == 200) {
228 228
        self.pithosAccount = [accountRequest account];
229 229
        
......
236 236
        if ([someContainers count] < 10000) {
237 237
            if (!accountRequest.didUseCachedResponse || ([containers count] != [someContainers count]) || !children) {
238 238
                // Save new children
239
                NSLog(@"using newChildren");
239
                DLog(@"using newChildren");
240 240
                newChildren = [[NSMutableArray alloc] init];
241 241
                NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
242 242
                for (ASIPithosContainer *container in containers) {
......
316 316

  
317 317
- (void)accountMetadataRequestFinished:(ASIPithosAccountRequest *)request {
318 318
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
319
    NSLog(@"URL: %@", [request url]);
320
    NSLog(@"cached: %d", [request didUseCachedResponse]);
319
    DLog(@"URL: %@", [request url]);
320
    DLog(@"cached: %d", [request didUseCachedResponse]);
321 321
    
322 322
    if ([request isEqualTo:applyMetadataAccountRequest]) {
323 323
        @synchronized(self) {
b/pithos-macos/PithosActivityFacility.m
209 209
    activity.message = message;
210 210
    activity.totalBytes = totalBytes;
211 211
    activity.currentBytes = currentBytes;
212
    NSLog(@"PithosActivityFacility startedActivity %@", activity);
212
    DLog(@"PithosActivityFacility startedActivity %@", activity);
213 213
    
214 214
    switch (type) {
215 215
        case PithosActivityUpload:
......
231 231
    @synchronized(self) {
232 232
        [runningActivities addObject:activity];
233 233
    }
234
    NSLog(@"PithosActivityFacility %@", self);
234
    DLog(@"PithosActivityFacility %@", self);
235 235
    
236 236
    return activity;
237 237
}
......
264 264
    @synchronized(self) {
265 265
        [endingActivities addObject:activity];
266 266
    }
267
    NSLog(@"PithosActivityFacility startedAndEndedActivity %@", activity);
267
    DLog(@"PithosActivityFacility startedAndEndedActivity %@", activity);
268 268
    
269 269
    return activity;
270 270
}
......
279 279
          currentBytes:(NSUInteger)currentBytes {
280 280
    if (!activity)
281 281
        return;
282
    NSLog(@"PithosActivityFacility updatedActivity %@", activity);
282
    DLog(@"PithosActivityFacility updatedActivity %@", activity);
283 283
    @synchronized(self) {
284 284
        activity.message = message;
285 285
        switch (activity.type) {
......
299 299
                break;
300 300
        }
301 301
    }
302
    NSLog(@"PithosActivityFacility %@", self);
302
    DLog(@"PithosActivityFacility %@", self);
303 303
}
304 304

  
305 305
- (void)updateActivity:(PithosActivity *)activity 
......
334 334
        }
335 335
        [endingActivities addObject:activity];
336 336
    }
337
    NSLog(@"PithosActivityFacility endedActivity %@", activity);
338
    NSLog(@"PithosActivityFacility %@", self);
337
    DLog(@"PithosActivityFacility endedActivity %@", activity);
338
    DLog(@"PithosActivityFacility %@", self);
339 339
}
340 340

  
341 341
- (void)endActivity:(PithosActivity *)activity 
b/pithos-macos/PithosBrowserController.m
427 427
    PithosNode *node = (PithosNode *)[notification object];
428 428
    if ((node == accountNode) || ![node.pithos isEqualTo:pithos])
429 429
        return;
430
    NSLog(@"pithosNodeChildrenUpdated:%@", node.url);
430
    DLog(@"pithosNodeChildrenUpdated:%@", node.url);
431 431
    NSInteger lastColumn = [browser lastColumn];
432 432
    for (NSInteger column = lastColumn; column >= 0; column--) {
433 433
        if ([[browser parentForItemsInColumn:column] isEqualTo:node]) {
......
910 910
  dropOperation:(NSBrowserDropOperation)dropOperation {
911 911
    if ([[[info draggingPasteboard] types] containsObject:NSFilenamesPboardType]) {
912 912
        NSArray *filenames = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];
913
        NSLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
913
        DLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
914 914
        if ((column != -1) && (filenames != nil)) {
915 915
            PithosNode *node;
916 916
            if (row != -1)
917 917
                node = [browser itemAtRow:row inColumn:column];
918 918
            else
919 919
                node = [browser parentForItemsInColumn:column];
920
            NSLog(@"drag in node: %@", node.url);
920
            DLog(@"drag in node: %@", node.url);
921 921
            return [self uploadFiles:filenames toNode:node];
922 922
        }
923 923
    } else if ([[[info draggingPasteboard] types] containsObject:NSFilesPromisePboardType]) {
924
        NSLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
924
        DLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
925 925
        if ((column != -1) && (draggedNodes != nil)) {
926 926
            PithosNode *node;
927 927
            if (row != -1)
928 928
                node = [browser itemAtRow:row inColumn:column];
929 929
            else
930 930
                node = [browser parentForItemsInColumn:column];
931
            NSLog(@"drag local node: %@", node.url);
931
            DLog(@"drag local node: %@", node.url);
932 932
            if ([info draggingSourceOperationMask] & NSDragOperationMove)
933 933
                return [self moveNodes:draggedNodes toNode:node];
934 934
            else if ([info draggingSourceOperationMask] & NSDragOperationCopy)
......
1130 1130
                    NSString *contentType = [PithosUtilities contentTypeOfFile:filePath error:&error];
1131 1131
                    if (contentType == nil)
1132 1132
                        contentType = @"application/octet-stream";
1133
                    #if DEBUG_PITHOS
1133 1134
                    if (error)
1134
                        NSLog(@"contentType detection error: %@", error);
1135
                        DLog(@"contentType detection error: %@", error);
1136
                    #endif
1135 1137
                    NSArray *hashes = nil;
1136 1138
                    if (operation.isCancelled) {
1137 1139
                        [pool drain];
......
1673 1675
- (void)requestFailed:(ASIPithosRequest *)request {
1674 1676
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1675 1677
    NSOperation *operation = [request.userInfo objectForKey:@"operation"];
1676
    NSLog(@"Request failed: %@", request.url);
1678
    DLog(@"Request failed: %@", request.url);
1677 1679
    if (operation.isCancelled) {
1678 1680
        [pool drain];
1679 1681
        return;        
......
1708 1710
- (void)downloadObjectFinished:(ASIPithosObjectRequest *)objectRequest {
1709 1711
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1710 1712
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1711
    NSLog(@"Download finished: %@", objectRequest.url);
1713
    DLog(@"Download finished: %@", objectRequest.url);
1712 1714
    if (operation.isCancelled) {
1713 1715
        [self requestFailed:objectRequest];
1714 1716
    } else if (objectRequest.responseStatusCode == 200) {
......
1724 1726
            // but this callback method is not called in the case of a directory download.
1725 1727
            // It maybe the case though, when downloading an old version of an object, is of a directory content type.
1726 1728
            // In this case, a file should be created. This is actually a feature that allows you to hide data in a directory object.
1727
            NSLog(@"Downloaded  0 bytes");
1729
            DLog(@"Downloaded  0 bytes");
1728 1730
            NSFileManager *fileManager = [NSFileManager defaultManager];
1729 1731
            if (![fileManager fileExistsAtPath:filePath]) {
1730 1732
                if (![fileManager createFileAtPath:filePath contents:nil attributes:nil]) {
......
1758 1760
- (void)uploadDirectoryObjectFinished:(ASIPithosObjectRequest *)objectRequest {
1759 1761
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1760 1762
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1761
    NSLog(@"Upload directory object finished: %@", objectRequest.url);
1763
    DLog(@"Upload directory object finished: %@", objectRequest.url);
1762 1764
    if (operation.isCancelled) {
1763 1765
        [self requestFailed:objectRequest];
1764 1766
    } else if (objectRequest.responseStatusCode == 201) {
1765
        NSLog(@"Directory object created: %@", objectRequest.url);
1767
        DLog(@"Directory object created: %@", objectRequest.url);
1766 1768
        dispatch_async(dispatch_get_main_queue(), ^{
1767 1769
            [activityFacility endActivity:[objectRequest.userInfo objectForKey:@"activity"] 
1768 1770
                              withMessage:[objectRequest.userInfo objectForKey:@"finishedActivityMessage"]];
......
1787 1789
- (void)uploadObjectUsingHashMapFinished:(ASIPithosObjectRequest *)objectRequest {
1788 1790
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1789 1791
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1790
    NSLog(@"Upload using hashmap finished: %@", objectRequest.url);
1792
    DLog(@"Upload using hashmap finished: %@", objectRequest.url);
1791 1793
    NSString *fileName = [objectRequest.userInfo objectForKey:@"fileName"];
1792 1794
    PithosActivity *activity = [objectRequest.userInfo objectForKey:@"activity"];
1793 1795
    NSUInteger totalBytes = activity.totalBytes;
......
1795 1797
    if (operation.isCancelled) {
1796 1798
        [self requestFailed:objectRequest];
1797 1799
    } else if (objectRequest.responseStatusCode == 201) {
1798
        NSLog(@"Object created: %@", objectRequest.url);
1800
        DLog(@"Object created: %@", objectRequest.url);
1799 1801
        dispatch_async(dispatch_get_main_queue(), ^{
1800 1802
            [activityFacility endActivity:activity 
1801 1803
                              withMessage:[objectRequest.userInfo objectForKey:@"finishedActivityMessage"] 
......
1815 1817
    } else if (objectRequest.responseStatusCode == 409) {
1816 1818
        NSUInteger iteration = [[objectRequest.userInfo objectForKey:@"iteration"] unsignedIntegerValue];
1817 1819
        if (iteration == 0) {
1818
            NSLog(@"Upload iteration limit reached: %@", objectRequest.url);
1820
            DLog(@"Upload iteration limit reached: %@", objectRequest.url);
1819 1821
            dispatch_async(dispatch_get_main_queue(), ^{
1820 1822
                [activityFacility endActivity:activity 
1821 1823
                                  withMessage:[objectRequest.userInfo objectForKey:@"failedActivityMessage"]]; 
......
1829 1831
            [pool drain];
1830 1832
            return;
1831 1833
        }
1832
        NSLog(@"object is missing hashes: %@", objectRequest.url);
1834
        DLog(@"object is missing hashes: %@", objectRequest.url);
1833 1835
        NSIndexSet *missingBlocks = [PithosUtilities missingBlocksForHashes:[objectRequest.userInfo objectForKey:@"hashes"]
1834 1836
                                                          withMissingHashes:[objectRequest hashes]];
1835 1837
        NSUInteger blockSize = [[objectRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue];
......
1874 1876
- (void)uploadMissingBlockFinished:(ASIPithosContainerRequest *)containerRequest {
1875 1877
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1876 1878
    NSOperation *operation = [containerRequest.userInfo objectForKey:@"operation"];
1877
    NSLog(@"Upload of missing block finished: %@", containerRequest.url);
1879
    DLog(@"Upload of missing block finished: %@", containerRequest.url);
1878 1880
    NSUInteger blockSize = [[containerRequest.userInfo objectForKey:@"blockSize"] unsignedIntegerValue];
1879 1881
    NSString *fileName = [containerRequest.userInfo objectForKey:@"fileName"];
1880 1882
    PithosActivity *activity = [containerRequest.userInfo objectForKey:@"activity"];
......
1936 1938
- (void)moveFinished:(ASIPithosObjectRequest *)objectRequest {
1937 1939
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1938 1940
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1939
    NSLog(@"Move object finished: %@", objectRequest.url);
1941
    DLog(@"Move object finished: %@", objectRequest.url);
1940 1942
    if (operation.isCancelled) {
1941 1943
        [self requestFailed:objectRequest];
1942 1944
    } else if (objectRequest.responseStatusCode == 201) {
......
1964 1966
- (void)copyFinished:(ASIPithosObjectRequest *)objectRequest {
1965 1967
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1966 1968
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1967
    NSLog(@"Copy object finished: %@", objectRequest.url);
1969
    DLog(@"Copy object finished: %@", objectRequest.url);
1968 1970
    if (operation.isCancelled) {
1969 1971
        [self requestFailed:objectRequest];
1970 1972
    } else if (objectRequest.responseStatusCode == 201) {
......
1992 1994
- (void)deleteObjectFinished:(ASIPithosObjectRequest *)objectRequest {
1993 1995
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1994 1996
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1995
    NSLog(@"Delete object finished: %@", objectRequest.url);
1997
    DLog(@"Delete object finished: %@", objectRequest.url);
1996 1998
    if (operation.isCancelled) {
1997 1999
        [self requestFailed:objectRequest];
1998 2000
    } else if (objectRequest.responseStatusCode == 204) {
......
2114 2116
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id<NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index {
2115 2117
    if ([[[info draggingPasteboard] types] containsObject:NSFilenamesPboardType]) {
2116 2118
        NSArray *filenames = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];
2117
        NSLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
2119
        DLog(@"drag in operation: %lu filenames: %@", [info draggingSourceOperationMask], filenames);
2118 2120
        if (item && (index == NSOutlineViewDropOnItemIndex) && (filenames != nil)) {
2119 2121
            PithosNode *node = (PithosNode *)item;
2120
            NSLog(@"drag in node: %@", node.url);
2122
            DLog(@"drag in node: %@", node.url);
2121 2123
            return [self uploadFiles:filenames toNode:node];
2122 2124
        }
2123 2125
    } else if ([[[info draggingPasteboard] types] containsObject:NSFilesPromisePboardType]) {
2124
        NSLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
2126
        DLog(@"drag local operation: %lu nodes: %@", [info draggingSourceOperationMask], draggedNodes);
2125 2127
        if (item && (index == NSOutlineViewDropOnItemIndex) && (draggedNodes != nil)) {
2126 2128
            PithosNode *node = (PithosNode *)item;
2127
            NSLog(@"drag local node: %@", node.url);
2129
            DLog(@"drag local node: %@", node.url);
2128 2130
            if (![[draggedNodes objectAtIndex:0] shared] && ![[draggedNodes objectAtIndex:0] sharingAccount] && 
2129 2131
                ([info draggingSourceOperationMask] & NSDragOperationMove))
2130 2132
                return [self moveNodes:draggedNodes toNode:node];
b/pithos-macos/PithosContainerNode.m
256 256

  
257 257
- (void)containerRequestFinished:(ASIPithosContainerRequest *)request {
258 258
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
259
    NSLog(@"List container finished: %@", [containerRequest url]);
260
    NSLog(@"Cached: %d", [containerRequest didUseCachedResponse]);
259
    DLog(@"List container finished: %@", [containerRequest url]);
260
    DLog(@"Cached: %d", [containerRequest didUseCachedResponse]);
261 261
    if (containerRequest.responseStatusCode == 200) {
262 262
        if ((pithosContainer.blockHash == nil) || (pithosContainer.blockSize == 0)) {
263 263
            pithosContainer.blockHash = [containerRequest blockHash];
......
273 273
        if ([someObjects count] < 10000) {
274 274
            if (!containerRequest.didUseCachedResponse || ([objects count] != [someObjects count]) || !children) {
275 275
                // Save new children
276
                NSLog(@"using newChildren");
276
                DLog(@"using newChildren");
277 277
                newChildren = [[NSMutableArray alloc] init];
278 278
                NSArray *objectNames = [objects valueForKey:@"name"];
279 279
                NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
......
416 416

  
417 417
- (void)containerMetadataRequestFinished:(ASIPithosContainerRequest *)request {
418 418
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
419
    NSLog(@"URL: %@", [request url]);
420
    NSLog(@"cached: %d", [request didUseCachedResponse]);
419
    DLog(@"URL: %@", [request url]);
420
    DLog(@"cached: %d", [request didUseCachedResponse]);
421 421
    
422 422
    if ([request isEqualTo:applyMetadataContainerRequest]) {
423 423
        @synchronized(self) {
b/pithos-macos/PithosObjectNode.m
162 162

  
163 163
- (void)objectRequestFinished:(ASIPithosObjectRequest *)request {
164 164
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
165
    NSLog(@"URL: %@", [request url]);
166
    NSLog(@"cached: %d", [request didUseCachedResponse]);
165
    DLog(@"URL: %@", [request url]);
166
    DLog(@"cached: %d", [request didUseCachedResponse]);
167 167
    
168 168
    if ([request isEqualTo:applyMetadataObjectRequest]) {
169 169
        int responseStatusCode = applyMetadataObjectRequest.responseStatusCode;
b/pithos-macos/PithosSharingAccountsNode.m
184 184

  
185 185
- (void)sharingAccountsRequestFinished:(ASIPithosRequest *)request {
186 186
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
187
    NSLog(@"List sharing accounts finished: %@", [sharingAccountsRequest url]);
188
    NSLog(@"Cached: %d", [sharingAccountsRequest didUseCachedResponse]);
187
    DLog(@"List sharing accounts finished: %@", [sharingAccountsRequest url]);
188
    DLog(@"Cached: %d", [sharingAccountsRequest didUseCachedResponse]);
189 189
    if (sharingAccountsRequest.responseStatusCode == 200) {
190 190
        NSArray *someSharingAccounts = [sharingAccountsRequest sharingAccounts];
191 191
        if (sharingAccounts == nil) {
......
196 196
        if ([someSharingAccounts count] < 10000) {
197 197
            if (!sharingAccountsRequest.didUseCachedResponse || ([sharingAccounts count] != [someSharingAccounts count]) || !children) {
198 198
                // Save new children
199
                NSLog(@"using newChildren");
199
                DLog(@"using newChildren");
200 200
                newChildren = [[NSMutableArray alloc] init];
201 201
                NSMutableIndexSet *keptNodes = [NSMutableIndexSet indexSet];
202 202
                for (ASIPithosAccount *account in sharingAccounts) {
b/pithos-macos/PithosSubdirNode.m
170 170

  
171 171
- (void)objectRequestFinished:(ASIPithosObjectRequest *)request {
172 172
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
173
    NSLog(@"URL: %@", [request url]);
174
    NSLog(@"cached: %d", [request didUseCachedResponse]);
173
    DLog(@"URL: %@", [request url]);
174
    DLog(@"cached: %d", [request didUseCachedResponse]);
175 175
    
176 176
    if ([request isEqualTo:applyMetadataObjectRequest]) {
177 177
        int responseStatusCode = applyMetadataObjectRequest.responseStatusCode;
b/pithos-macos/PithosSyncDaemon.m
477 477
            syncIncomplete = YES;
478 478
        if (syncOperationCount == 0) {
479 479
            // XXX This shouldn't happen, maybe change operationCount to a BOOL as operationsPending in browser
480
            NSLog(@"Sync::WARNING: tried to decrease syncOperationCount when 0");
480
            DLog(@"Sync::WARNING: tried to decrease syncOperationCount when 0");
481 481
            return;
482 482
        }
483 483
        syncOperationCount--;
......
796 796
            // Remote object created in the meantime, just mark the sync cycle as incomplete, but do delete the local object
797 797
            syncIncomplete = YES;
798 798
        }
799
        NSLog(@"Sync::delete local object: %@", filePath);
799
        DLog(@"Sync::delete local object: %@", filePath);
800 800
        if (!fileExists || [self moveToTempTrashFile:filePath accountName:accountName pithosContainer:pithosContainer]) {
801 801
            dispatch_async(dispatch_get_main_queue(), ^{
802 802
                [activityFacility startAndEndActivityWithType:PithosActivityOther 
......
815 815
            [pool drain];
816 816
            return;
817 817
        }
818
        NSLog(@"Sync::create local directory object: %@", filePath);
818
        DLog(@"Sync::create local directory object: %@", filePath);
819 819
        BOOL directoryCreated = NO;
820 820
        if (!fileExists || (!isDirectory && [self moveToTempTrashFile:filePath accountName:accountName pithosContainer:pithosContainer])) {
821
            NSLog(@"Sync::local directory object doesn't exist: %@", filePath);
821
            DLog(@"Sync::local directory object doesn't exist: %@", filePath);
822 822
            error = nil;
823 823
            if (![fileManager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:&error] || error) {
824 824
                [PithosUtilities fileActionFailedAlertWithTitle:@"Create Directory Error" 
......
831 831
                [self saveLocalState];
832 832
            }
833 833
        } else {
834
            NSLog(@"Sync::local directory object exists: %@", filePath);
834
            DLog(@"Sync::local directory object exists: %@", filePath);
835 835
            directoryCreated = YES;
836 836
        }
837 837
        if (directoryCreated)
......
850 850
            [pool drain];
851 851
            return;
852 852
        }
853
        NSLog(@"Sync::create local zero length object: %@", filePath);
853
        DLog(@"Sync::create local zero length object: %@", filePath);
854 854
        BOOL fileCreated = NO;
855 855
        if (!fileExists || 
856 856
            ((isDirectory || [PithosUtilities bytesOfFile:filePath]) && 
857 857
             [self moveToTempTrashFile:filePath accountName:accountName pithosContainer:pithosContainer])) {
858
            NSLog(@"Sync::local zero length object doesn't exist: %@", filePath);
858
            DLog(@"Sync::local zero length object doesn't exist: %@", filePath);
859 859
            // Create directory of the file, if it doesn't exist
860 860
            error = nil;
861 861
            if (![PithosUtilities safeCreateDirectory:fileDirectoryPath error:&error]) {
......
878 878
                [self saveLocalState];
879 879
            }
880 880
        } else {
881
            NSLog(@"Sync::local zero length object exists: %@", filePath);
881
            DLog(@"Sync::local zero length object exists: %@", filePath);
882 882
            fileCreated = YES;
883 883
        }
884 884
        if (fileCreated)
......
1227 1227
        object.contentType = [PithosUtilities contentTypeOfFile:filePath error:&error];
1228 1228
        if (object.contentType == nil)
1229 1229
            object.contentType = @"application/octet-stream";
1230
        #if DEBUG_PITHOS
1230 1231
        if (error)
1231
            NSLog(@"contentType detection error: %@", error);
1232
            DLog(@"contentType detection error: %@", error);
1233
        #endif
1232 1234
        NSArray *hashes = nil;
1233 1235
        ASIPithosObjectRequest *objectRequest = [PithosUtilities writeObjectDataRequestWithPithos:pithos 
1234 1236
                                                                                    containerName:pithosContainer.name 
......
1333 1335
- (void)listRequestFinished:(ASIPithosContainerRequest *)containerRequest {
1334 1336
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1335 1337
    NSOperation *operation = [containerRequest.userInfo objectForKey:@"operation"];
1336
    NSLog(@"Sync::list request finished: %@", containerRequest.url);
1338
    DLog(@"Sync::list request finished: %@", containerRequest.url);
1337 1339
    if (operation.isCancelled) {
1338 1340
        [self listRequestFailed:containerRequest];
1339 1341
    } else if ((containerRequest.responseStatusCode == 200) || 
......
1611 1613
                        filePath = [filePath stringByAppendingString:@":"];
1612 1614
                    ASIPithosObject *object = [ASIPithosObject object];
1613 1615
                    object.name = objectName;
1614
                    NSLog(@"Sync::object name: %@", object.name);
1616
                    DLog(@"Sync::object name: %@", object.name);
1615 1617

  
1616 1618
                    PithosLocalObjectState *storedLocalObjectState = [containerStoredLocalObjectStates objectForKey:object.name];
1617 1619
                    PithosLocalObjectState *currentLocalObjectState = [currentLocalObjectStates objectForKey:filePath];
......
1675 1677

  
1676 1678
                    BOOL localStateHasChanged = ![currentLocalObjectState isEqualToState:storedLocalObjectState];
1677 1679
                    BOOL serverStateHasChanged = ![remoteObjectState isEqualToState:storedLocalObjectState];
1678
                    NSLog(@"Sync::localStateHasChanged: %d, serverStateHasChanged: %d", localStateHasChanged, serverStateHasChanged);
1680
                    DLog(@"Sync::localStateHasChanged: %d, serverStateHasChanged: %d", localStateHasChanged, serverStateHasChanged);
1679 1681
                    if (!localStateHasChanged) {
1680 1682
                        // Local state hasn't changed
1681 1683
                        if (serverStateHasChanged) {
......
1822 1824
- (void)downloadObjectBlockFinished:(ASIPithosObjectRequest *)objectRequest {
1823 1825
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1824 1826
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1825
    NSLog(@"Sync::download object block finished: %@", objectRequest.url);
1827
    DLog(@"Sync::download object block finished: %@", objectRequest.url);
1826 1828
    if (operation.isCancelled) {
1827 1829
        [self requestFailed:objectRequest];
1828 1830
    } else if (objectRequest.responseStatusCode == 206) {
......
1985 1987
- (void)downloadObjectHashMapFinished:(ASIPithosObjectRequest *)objectRequest {
1986 1988
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1987 1989
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
1988
    NSLog(@"Sync::download object hashmap finished: %@", objectRequest.url);
1990
    DLog(@"Sync::download object hashmap finished: %@", objectRequest.url);
1989 1991
    if (operation.isCancelled) {
1990 1992
        [self requestFailed:objectRequest];
1991 1993
    } else if (objectRequest.responseStatusCode == 200) {
......
2049 2051
- (void)uploadDirectoryObjectFinished:(ASIPithosObjectRequest *)objectRequest {
2050 2052
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2051 2053
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
2052
    NSLog(@"Sync::upload directory object finished: %@", objectRequest.url);
2054
    DLog(@"Sync::upload directory object finished: %@", objectRequest.url);
2053 2055
    if (operation.isCancelled) {
2054 2056
        [self requestFailed:objectRequest];
2055 2057
    } else if (objectRequest.responseStatusCode == 201) {
......
2072 2074
- (void)moveObjectToTrashFinished:(ASIPithosObjectRequest *)objectRequest {
2073 2075
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2074 2076
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
2075
    NSLog(@"Sync::move object to trash finished: %@", objectRequest.url);
2077
    DLog(@"Sync::move object to trash finished: %@", objectRequest.url);
2076 2078
    if (operation.isCancelled) {
2077 2079
        [self requestFailed:objectRequest];
2078 2080
    } else if (objectRequest.responseStatusCode == 201) {
......
2094 2096
- (void)deleteObjectFinished:(ASIPithosObjectRequest *)objectRequest {
2095 2097
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2096 2098
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
2097
    NSLog(@"Sync::delete object finished: %@", objectRequest.url);
2099
    DLog(@"Sync::delete object finished: %@", objectRequest.url);
2098 2100
    if (operation.isCancelled) {
2099 2101
        [self requestFailed:objectRequest];
2100 2102
    } else if (objectRequest.responseStatusCode == 204) {
......
2116 2118
- (void)uploadObjectUsingHashMapFinished:(ASIPithosObjectRequest *)objectRequest {
2117 2119
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2118 2120
    NSOperation *operation = [objectRequest.userInfo objectForKey:@"operation"];
2119
    NSLog(@"Sync::upload using hashmap finished: %@", objectRequest.url);
2121
    DLog(@"Sync::upload using hashmap finished: %@", objectRequest.url);
2120 2122
    NSString *accountName = [objectRequest.userInfo objectForKey:@"accountName"];
2121 2123
    ASIPithosContainer *pithosContainer = [objectRequest.userInfo objectForKey:@"pithosContainer"];
2122 2124
    ASIPithosObject *object = [objectRequest.userInfo objectForKey:@"pithosObject"];
......
2129 2131
    if (operation.isCancelled) {
2130 2132
        [self requestFailed:objectRequest];
2131 2133
    } else if (objectRequest.responseStatusCode == 201) {
2132
        NSLog(@"Sync::object created: %@", objectRequest.url);
2134
        DLog(@"Sync::object created: %@", objectRequest.url);
2133 2135
        storedState.filePath = [objectRequest.userInfo objectForKey:@"filePath"];
2134 2136
        storedState.hash = object.objectHash;
2135 2137
        [self saveLocalState];
......
2146 2148
        } else {
2147 2149
            NSUInteger iteration = [[objectRequest.userInfo objectForKey:@"iteration"] unsignedIntegerValue];
2148 2150
            if (iteration == 0) {
2149
                NSLog(@"Sync::upload iteration limit reached: %@", objectRequest.url);
2151
                DLog(@"Sync::upload iteration limit reached: %@", objectRequest.url);
2150 2152
                dispatch_async(dispatch_get_main_queue(), ^{
2151 2153
                    [activityFacility endActivity:activity withMessage:[objectRequest.userInfo objectForKey:@"stoppedActivityMessage"]];
2152 2154
                });
......
2154 2156
                [pool drain];
2155 2157
                return;
2156 2158
            }
2157
            NSLog(@"Sync::object is missing hashes: %@", objectRequest.url);
2159
            DLog(@"Sync::object is missing hashes: %@", objectRequest.url);
2158 2160
            NSIndexSet *missingBlocks = [PithosUtilities missingBlocksForHashes:[objectRequest.userInfo objectForKey:@"hashes"]
2159 2161
                                                              withMissingHashes:[objectRequest hashes]];
2160 2162
            if (totalBytes >= [missingBlocks count]*pithosContainer.blockSize)
......
2202 2204
- (void)uploadMissingBlockFinished:(ASIPithosContainerRequest *)containerRequest {
2203 2205
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2204 2206
    NSOperation *operation = [containerRequest.userInfo objectForKey:@"operation"];
2205
    NSLog(@"Sync::upload of missing block finished: %@", containerRequest.url);
2207
    DLog(@"Sync::upload of missing block finished: %@", containerRequest.url);
2206 2208
    if (operation.isCancelled) {
2207 2209
        [self requestFailed:containerRequest];
2208 2210
    } else if (containerRequest.responseStatusCode == 202) {
......
2272 2274
- (void)requestFailed:(ASIPithosRequest *)request {
2273 2275
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
2274 2276
    NSOperation *operation = [request.userInfo objectForKey:@"operation"];
2275
    NSLog(@"Sync::request failed: %@", request.url);
2277
    DLog(@"Sync::request failed: %@", request.url);
2276 2278
    if (operation.isCancelled) {
2277 2279
        [pool drain];
2278 2280
        return;        
b/pithos-macos/PithosUtilities.m
92 92
        [fileManager removeItemAtPath:directoryPath error:&error];
93 93
    }
94 94
    if (error) {
95
        NSLog(@"Cannot remove existing file '%@': %@", fileName, error);
95
        DLog(@"Cannot remove existing file '%@': %@", fileName, error);
96 96
        dispatch_async(dispatch_get_main_queue(), ^{
97 97
            NSAlert *alert = [[[NSAlert alloc] init] autorelease];
98 98
            [alert setMessageText:@"Removal Error"];
......
153 153
    NSError *error = nil;
154 154
    [fileManager createDirectoryAtPath:[directoryPath stringByAppendingPathComponent:subdirName] withIntermediateDirectories:YES attributes:nil error:&error];
155 155
    if (error) {
156
        NSLog(@"Cannot create directory at '%@': %@", directoryPath, error);
156
        DLog(@"Cannot create directory at '%@': %@", directoryPath, error);
157 157
        dispatch_async(dispatch_get_main_queue(), ^{
158 158
            NSAlert *alert = [[[NSAlert alloc] init] autorelease];
159 159
            [alert setMessageText:@"Create Directory Error"];
......
175 175
            if (!directoryExists) {
176 176
                [fileManager createDirectoryAtPath:subdirDirectoryPath withIntermediateDirectories:YES attributes:nil error:&error];
177 177
                if (error) {
178
                    NSLog(@"Cannot create directory at '%@': %@", subdirDirectoryPath, error);
178
                    DLog(@"Cannot create directory at '%@': %@", subdirDirectoryPath, error);
179 179
                    dispatch_async(dispatch_get_main_queue(), ^{
180 180
                        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
181 181
                        [alert setMessageText:@"Create Directory Error"];
......
188 188
            } else if (!directoryIsDirectory) {
189 189
                [fileManager removeItemAtPath:subdirDirectoryPath error:&error];
190 190
                if (error) {
191
                    NSLog(@"Cannot remove existing file at '%@': %@", subdirDirectoryPath, error);
191
                    DLog(@"Cannot remove existing file at '%@': %@", subdirDirectoryPath, error);
192 192
                    dispatch_async(dispatch_get_main_queue(), ^{
193 193
                        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
194 194
                        [alert setMessageText:@"Remove File Error"];
......
467 467
                    contentType = [self contentTypeOfFile:filePath error:&error];
468 468
                    if (contentType == nil)
469 469
                        contentType = @"application/octet-stream";
470
                    #if DEBUG_PITHOS
470 471
                    if (error)
471
                        NSLog(@"contentType detection error: %@", error);
472
                        DLog(@"contentType detection error: %@", error);
473
                    #endif
472 474
                    objectRequest = [ASIPithosObjectRequest writeObjectDataRequestWithPithos:pithos 
473 475
                                                                               containerName:containerName 
474 476
                                                                                  objectName:subObjectName 
......
1200 1202
                         [request requestHeaders], 
1201 1203
                         [request responseHeaders], 
1202 1204
                         [request responseString]];
1203
    NSLog(@"%@", message);
1205
    DLog(@"%@", message);
1204 1206
    dispatch_async(dispatch_get_main_queue(), ^{    
1205 1207
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1206 1208
        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
......
1226 1228
                         [request requestHeaders], 
1227 1229
                         [request responseHeaders], 
1228 1230
                         [request responseString]];
1229
    NSLog(@"%@", message);
1231
    DLog(@"%@", message);
1230 1232
    dispatch_async(dispatch_get_main_queue(), ^{
1231 1233
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1232 1234
        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
b/pithos-macos/pithos-macos-Info.plist
17 17
	<key>CFBundlePackageType</key>
18 18
	<string>APPL</string>
19 19
	<key>CFBundleShortVersionString</key>
20
	<string>0.9.5</string>
20
	<string>1.0</string>
21 21
	<key>CFBundleSignature</key>
22 22
	<string>????</string>
23 23
	<key>CFBundleURLTypes</key>
......
32 32
		</dict>
33 33
	</array>
34 34
	<key>CFBundleVersion</key>
35
	<string>20120416.0</string>
35
	<string>20120517.0</string>
36 36
	<key>LSMinimumSystemVersion</key>
37 37
	<string>${MACOSX_DEPLOYMENT_TARGET}</string>
38 38
	<key>NSMainNibFile</key>
b/pithos-macos/pithos-macos-Prefix.pch
5 5
#ifdef __OBJC__
6 6
    #import <Cocoa/Cocoa.h>
7 7
#endif
8

  
9
#ifndef DEBUG_PITHOS
10
    #define DEBUG_PITHOS 0
11
#endif
12

  
13
#if DEBUG_PITHOS
14
    #define DLog(fmt, ...) NSLog(@"%s: " fmt, __PRETTY_FUNCTION__, ##__VA_ARGS__)
15
#else
16
    #define DLog(...)
17
#endif
b/pithos-macos/pithos_macosAppDelegate.m
184 184
                         stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
185 185
        }
186 186
        
187
        NSLog(@"query authUser: '%@', authToken: '%@'", authUser, authToken);
187
        DLog(@"query authUser: '%@', authToken: '%@'", authUser, authToken);
188 188
        if ([authUser length] && [authToken length]) {
189 189
            [pithosAccount authenticateWithServerURL:nil authUser:authUser authToken:authToken];
190 190
            [self savePithosAccounts:self];
......
515 515
            self.checkForUpdatesNotRunning = YES;
516 516
            return;
517 517
        }
518
        NSLog(@"Check for update plist error: %@", error);
518
        DLog(@"Check for update plist error: %@", error);
519 519
     }
520 520
}
521 521

  

Also available in: Unified diff