iOS中获取程序目录路径

// 获取程序Documents目录路径
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

// 获取程序app文件所在目录路径
NSHomeDirectory();

// 获取程序tmp目录路径
NSTemporaryDirectory();

// 获取程序应用包路径
[[NSBundle mainBundle] resourcePath];

[[NSBundle mainBundle] pathForResource: @"info" ofType: @"txt"];

来源:http://www.cnblogs.com/kaixuan/archive/2011/05/31/2064796.html

comments powered by Disqus