Revision cb6abe72 pithos-macos/PithosUtilities.m
b/pithos-macos/PithosUtilities.m | ||
---|---|---|
72 | 72 |
if (ifExists && [fileManager fileExistsAtPath:destinationPath]) { |
73 | 73 |
__block NSInteger choice; |
74 | 74 |
dispatch_sync(dispatch_get_main_queue(), ^{ |
75 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
75 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
76 | 76 |
[alert setMessageText:@"File Exists"]; |
77 | 77 |
[alert setInformativeText:[NSString stringWithFormat:@"A file or directory named '%@' already exists, do you want to replace it?", fileName]]; |
78 | 78 |
[alert addButtonWithTitle:@"OK"]; |
... | ... | |
94 | 94 |
if (error) { |
95 | 95 |
DLog(@"Cannot remove existing file '%@': %@", fileName, error); |
96 | 96 |
dispatch_async(dispatch_get_main_queue(), ^{ |
97 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
97 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
98 | 98 |
[alert setMessageText:@"Removal Error"]; |
99 | 99 |
[alert setInformativeText:[NSString stringWithFormat:@"Cannot remove existing file '%@': %@", |
100 | 100 |
fileName, [error localizedDescription]]]; |
... | ... | |
130 | 130 |
if (ifExists && [[NSFileManager defaultManager] fileExistsAtPath:destinationPath]) { |
131 | 131 |
__block NSInteger choice; |
132 | 132 |
dispatch_sync(dispatch_get_main_queue(), ^{ |
133 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
133 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
134 | 134 |
[alert setMessageText:@"File exists"]; |
135 | 135 |
[alert setInformativeText:[NSString stringWithFormat:@"A file or directory named '%@' already exists, do you want to replace it?", subdirName]]; |
136 | 136 |
[alert addButtonWithTitle:@"OK"]; |
... | ... | |
155 | 155 |
if (error) { |
156 | 156 |
DLog(@"Cannot create directory at '%@': %@", directoryPath, error); |
157 | 157 |
dispatch_async(dispatch_get_main_queue(), ^{ |
158 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
158 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
159 | 159 |
[alert setMessageText:@"Create Directory Error"]; |
160 | 160 |
[alert setInformativeText:[NSString stringWithFormat:@"Cannot create directory at '%@': %@", |
161 | 161 |
directoryPath, [error localizedDescription]]]; |
... | ... | |
177 | 177 |
if (error) { |
178 | 178 |
DLog(@"Cannot create directory at '%@': %@", subdirDirectoryPath, error); |
179 | 179 |
dispatch_async(dispatch_get_main_queue(), ^{ |
180 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
180 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
181 | 181 |
[alert setMessageText:@"Create Directory Error"]; |
182 | 182 |
[alert setInformativeText:[NSString stringWithFormat:@"Cannot create directory at '%@': %@", |
183 | 183 |
subdirDirectoryPath, [error localizedDescription]]]; |
... | ... | |
190 | 190 |
if (error) { |
191 | 191 |
DLog(@"Cannot remove existing file at '%@': %@", subdirDirectoryPath, error); |
192 | 192 |
dispatch_async(dispatch_get_main_queue(), ^{ |
193 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
193 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
194 | 194 |
[alert setMessageText:@"Remove File Error"]; |
195 | 195 |
[alert setInformativeText:[NSString stringWithFormat:@"Cannot remove existing file at '%@': %@", |
196 | 196 |
subdirDirectoryPath, [error localizedDescription]]]; |
... | ... | |
339 | 339 |
free(tempFileNameCString); |
340 | 340 |
if (fileDescriptor == -1) { |
341 | 341 |
dispatch_async(dispatch_get_main_queue(), ^{ |
342 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
342 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
343 | 343 |
[alert setMessageText:@"Create Temporary File Error"]; |
344 | 344 |
[alert setInformativeText:[NSString stringWithFormat:@"Cannot create temporary file at '%@'", tempFilePath]]; |
345 | 345 |
[alert addButtonWithTitle:@"OK"]; |
... | ... | |
410 | 410 |
NSArray *subPaths = [fileManager subpathsOfDirectoryAtPath:directoryPath error:&error]; |
411 | 411 |
if (error) { |
412 | 412 |
dispatch_async(dispatch_get_main_queue(), ^{ |
413 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
413 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
414 | 414 |
[alert setMessageText:@"Directory Read Error"]; |
415 | 415 |
[alert setInformativeText:[NSString stringWithFormat:@"Cannot read contents of directory '%@': %@", |
416 | 416 |
[directoryPath lastPathComponent], [error localizedDescription]]]; |
... | ... | |
927 | 927 |
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType); |
928 | 928 |
CFRelease(uti); |
929 | 929 |
CFRelease(url); |
930 |
return [(NSString *)MIMEType autorelease];
|
|
930 |
return (__bridge_transfer NSString *)MIMEType;
|
|
931 | 931 |
} |
932 | 932 |
} |
933 | 933 |
CFRelease(url); |
... | ... | |
1022 | 1022 |
} else if (objectExists) { |
1023 | 1023 |
__block NSInteger choice; |
1024 | 1024 |
dispatch_sync(dispatch_get_main_queue(), ^{ |
1025 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
1025 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
1026 | 1026 |
if (isDirectory) { |
1027 | 1027 |
[alert setMessageText:@"Directory Exists"]; |
1028 | 1028 |
if (sharingAccount) |
... | ... | |
1209 | 1209 |
DLog(@"%@", message); |
1210 | 1210 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1211 | 1211 |
@autoreleasepool { |
1212 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
1212 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
1213 | 1213 |
[alert setMessageText:@"HTTP Request Error"]; |
1214 | 1214 |
[alert setInformativeText:message]; |
1215 | 1215 |
[alert addButtonWithTitle:@"OK"]; |
... | ... | |
1235 | 1235 |
DLog(@"%@", message); |
1236 | 1236 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1237 | 1237 |
@autoreleasepool { |
1238 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
1238 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
1239 | 1239 |
[alert setMessageText:@"Unexpected Response Status"]; |
1240 | 1240 |
[alert setInformativeText:message]; |
1241 | 1241 |
[alert addButtonWithTitle:@"OK"]; |
... | ... | |
1247 | 1247 |
+ (void)httpAuthenticationError { |
1248 | 1248 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1249 | 1249 |
@autoreleasepool { |
1250 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
1250 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
1251 | 1251 |
[alert setMessageText:@"Authentication Error"]; |
1252 | 1252 |
[alert setInformativeText:@"Authentication error, please check your token or login again"]; |
1253 | 1253 |
[alert addButtonWithTitle:@"OK"]; |
... | ... | |
1259 | 1259 |
+ (void)fileActionFailedAlertWithTitle:(NSString *)title message:(NSString *)message error:(NSError *)error { |
1260 | 1260 |
dispatch_async(dispatch_get_main_queue(), ^{ |
1261 | 1261 |
@autoreleasepool { |
1262 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
1262 |
NSAlert *alert = [[NSAlert alloc] init];
|
|
1263 | 1263 |
[alert setMessageText:title]; |
1264 | 1264 |
if (error) |
1265 | 1265 |
[alert setInformativeText:[NSString stringWithFormat:@"%@: %@", message, [error localizedDescription]]]; |
... | ... | |
1286 | 1286 |
} |
1287 | 1287 |
|
1288 | 1288 |
+ (ASIPithosRequest *)copyRequest:(ASIPithosRequest *)request { |
1289 |
NSMutableDictionary *userInfo = (NSMutableDictionary *)[[request.userInfo retain] autorelease];
|
|
1289 |
NSMutableDictionary *userInfo = (NSMutableDictionary *)request.userInfo;
|
|
1290 | 1290 |
request.userInfo = nil; |
1291 | 1291 |
ASIPithosRequest *newRequest = [request copy]; |
1292 | 1292 |
newRequest.userInfo = userInfo; |
Also available in: Unified diff