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

    Dec 19, 2011
    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

    Jan 28, 2003
    Less lost in L.A.
    Look into this...

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

    Look into the NSFileManager class...

    [[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

    Dec 19, 2011
    I really appreciate your help..Thanks

Share This Page