how to get a path of a specific folder in xcode

Discussion in 'iOS Programming' started by tranvutuan, Dec 23, 2011.

  1. tranvutuan macrumors member

    Joined:
    Dec 19, 2011
    #1
    Hi everyone
    Given a folder name and it is in our project folder,are there any ways to get a full path of it.
     
  2. xStep, Dec 23, 2011
    Last edited: Dec 23, 2011

    xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    Look into this...

    Code:
    + (NSString *) appRootPathString
    {
    	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    	NSString * documentsDirectory = [paths objectAtIndex: 0];
    	return documentsDirectory;
    }
    

    Look into the NSFileManager class...

    Code:
    [[NSFileManager defaultManager] fileExistsAtPath: projectFolder]
    The variable projectFolder is an ivar in my class that I've already set in other code.

    Oh, and look at the 'Working with Paths' section of the NSString class.
     
  3. tranvutuan thread starter macrumors member

    Joined:
    Dec 19, 2011
    #3
    I really appreciate your help..Thanks
     

Share This Page