When I enter the program in xcode, I get "Couldn't create directory". However, when I list the directories within the parent directory (found in terminal via the currentDirectoryPath method) "testdir" is shown. Deleting "testdir" via terminal and re-running the program doesn't change the result. Neither does entering the entire path, as seen in the snippet below.
Can someone help me understand why that is happening?
#pragma mark - Program 16.3
NSString *dirName = @"/Users/macbookpro/Library/Developer/Xcode/DerivedData/chpt16-guztkkwddxxlehggqvdpabxemrok/Build/Products/Debug/testdir";
NSString *path;
NSFileManager *fm;
// Create an instance of the file manager
fm = [NSFileManager defaultManager];
// Get current directory
path = [fm currentDirectoryPath];
NSLog(@"Current directory path is %@", path);
// Create a new directory
if ([fm createDirectoryAtPath: dirName withIntermediateDirectories: YES attributes: nil error: NULL] == NO);
{
NSLog(@"Couldn't create directory");
return 1;
}