Revision 4650cc63 pithos-macos/PithosFileUtilities.m
b/pithos-macos/PithosFileUtilities.m | ||
---|---|---|
182 | 182 |
checkIfExists:(BOOL)ifExists |
183 | 183 |
hashes:(NSArray **)hashes { |
184 | 184 |
if (ifExists) { |
185 |
NSString *responseString; |
|
186 | 185 |
NSError *error; |
187 | 186 |
BOOL isDirectory; |
188 |
BOOL objectExists = [self objectExistsAtContainerName:containerName objectName:objectName |
|
189 |
responseString:&responseString error:&error isDirectory:&isDirectory]; |
|
190 |
NSAlert *alert; |
|
187 |
BOOL objectExists = [self objectExistsAtContainerName:containerName objectName:objectName |
|
188 |
error:&error isDirectory:&isDirectory]; |
|
191 | 189 |
if (error) { |
192 |
alert = [[[NSAlert alloc] init] autorelease]; |
|
193 |
[alert setMessageText:@"HTTP Request Error"]; |
|
194 |
[alert setInformativeText:[NSString stringWithFormat:@"HTTP Request Error: %@", error]]; |
|
195 |
[alert setInformativeText:[NSString stringWithFormat:@"HTTP Request Error: %@\nResponse String: %@", |
|
196 |
error, responseString]]; |
|
197 |
[alert addButtonWithTitle:@"OK"]; |
|
198 |
[alert runModal]; |
|
199 | 190 |
return nil; |
200 | 191 |
} else if (objectExists) { |
201 |
alert = [[[NSAlert alloc] init] autorelease]; |
|
192 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
|
202 | 193 |
if (isDirectory) { |
203 | 194 |
[alert setMessageText:@"Directory Exists"]; |
204 | 195 |
[alert setInformativeText:[NSString stringWithFormat:@"A directory with path '%@' in the container '%@' already exists, do you want to replace it?", objectName, containerName]]; |
... | ... | |
341 | 332 |
if (error) { |
342 | 333 |
return nil; |
343 | 334 |
} else if (objectExists) { |
344 |
if (!isDirectory) { |
|
345 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease]; |
|
346 |
[alert setMessageText:@"Object Exists"]; |
|
347 |
[alert setInformativeText:[NSString stringWithFormat:@"An object with path '%@' in the container '%@' already exists, do you want to replace it?", objectName, containerName]]; |
|
348 |
[alert addButtonWithTitle:@"OK"]; |
|
349 |
[alert addButtonWithTitle:@"Cancel"]; |
|
350 |
NSInteger choice = [alert runModal]; |
|
351 |
if (choice == NSAlertSecondButtonReturn) |
|
352 |
return nil; |
|
353 |
} else { |
|
354 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease]; |
|
335 |
NSAlert *alert = [[[NSAlert alloc] init] autorelease]; |
|
336 |
if (isDirectory) { |
|
355 | 337 |
[alert setMessageText:@"Directory Exists"]; |
356 | 338 |
[alert setInformativeText:[NSString stringWithFormat:@"A directory with path '%@' in the container '%@' already exists, do you want to replace it?", objectName, containerName]]; |
357 |
[alert addButtonWithTitle:@"OK"]; |
|
358 |
[alert addButtonWithTitle:@"Cancel"]; |
|
359 |
NSInteger choice = [alert runModal]; |
|
360 |
if (choice == NSAlertSecondButtonReturn) |
|
361 |
return nil; |
|
339 |
} else { |
|
340 |
[alert setMessageText:@"Object Exists"]; |
|
341 |
[alert setInformativeText:[NSString stringWithFormat:@"An object with path '%@' in the container '%@' already exists, do you want to replace it?", objectName, containerName]]; |
|
362 | 342 |
} |
343 |
[alert addButtonWithTitle:@"OK"]; |
|
344 |
[alert addButtonWithTitle:@"Cancel"]; |
|
345 |
NSInteger choice = [alert runModal]; |
|
346 |
if (choice == NSAlertSecondButtonReturn) |
|
347 |
return nil; |
|
363 | 348 |
} |
364 | 349 |
} |
365 | 350 |
|
Also available in: Unified diff