Monday, April 22, 2013

NSFileManager currentDirectoryPath example ios


currentDirectoryPath

Returns the path of the program’s current directory.
- (NSString *)currentDirectoryPath
Return Value
The path of the program’s current directory. If the program’s current working directory isn’t accessible, returns nil.
Discussion of [NSFileManager currentDirectoryPath]
The string returned by this method is initialized to the current working directory; you can change the working directory by invoking changeCurrentDirectoryPath:.
Relative pathnames refer implicitly to the current directory. For example, if the current directory is /tmp, and the relative pathname reports/info.txt is specified, the resulting full pathname is /tmp/reports/info.txt.
Example of [NSFileManager currentDirectoryPath]

NSString * pth = [[[NSFileManager defaultManager] currentDirectoryPath] copy];