Amazon.com Widgets 16.3 "Couldn't create directory"
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 21, 2013, 02:38:54 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Programming in Objective-C, 4th edition
| |-+  Chapter 16
| | |-+  16.3 "Couldn't create directory"
Pages: [1]   Go Down
Print
Author Topic: 16.3 "Couldn't create directory"  (Read 68 times)
soulfoodz
Newbie
*
Posts: 8


Email




« on: May 09, 2013, 01:11:17 PM »

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?


Code: (Objective-C)
#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;
        }

Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.