createDirectoryAtPath:withIntermediateDirectories:NO returns NO when dir exists
| Originator: | balicki.aleksander | ||
| Number: | rdar://11475448 | Date Originated: | 17-May-2012 07:52 PM |
| Status: | Open | Resolved: | |
| Product: | Product Version: | ||
| Classification: | Reproducible: |
17-May-2012 07:52 PM Aleksander Balicki:
Summary:
The method:
createDirectoryAtPath:withIntermediateDirectories:attributes:error:
when called with withIntermediateDirectories:NO, returns NO when the created directory does exist.
Documentation for this method says:
YES if the directory was created or already exists or NO if an error occurred.
Steps to Reproduce:
NSString *path = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), @"test"];
[[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
if (![[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:NO attributes:nil error:nil])
[NSException raise:@"CantCreateDirectory" format:@"Error creating a directory %@", path];
Expected Results:
The code should not raise the exception.
Actual Results:
The code raises the exception.
Regression:
Notes:
Please screen it to NSFileManager|X
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!