1. NSHomeDirectory() return the home directory of your application
2. NSTemporaryDirectory() return the temp directory of your application
3. Get document directory:
NSArray *arrayPaths = NSSearchPathForDirectorysInDomains(NSDocumentDirectory or NSCachesDirectory
NSUserDomainMask,
YES);
NSString *docDir = [arrayPaths objectAtIndex: 0];
4. NSBundle
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"exe"]; //another function with inDictory to search sub directory file
5. NSString stringWithContentsOfFile:encoding:error:
NSString *content = [NSString stringWithContentsOfFile:filePath encoding: NSUTF8StringEncoding error:nil];
6. NSString writeFileTo:atomically:encoding:
[content writeToFile:newFilePath atomically: YES encoding:NSUTF8Encoding error:nil];
iPhone application directory catalog:
drwxr-xr-x mobile mobile Documents /
drwxr-xr-x mobile mobile Library /
drwxr-xr-x mobile mobile Preferences /
drwxr-xr-x mobile mobile MyApp.app/
drw-r--r-- mobile mobile _CodeSignature
-rw-r--r-- mobile mobile Default.png
-rw-r--r-- mobile mobile icon.png
-rw-r--r-- mobile mobile Info.plist
-rwxr-xr-x mobile mobile MyApp
-rw-r--r-- mobile mobile pie.png
-rw-r--r-- mobile mobile PkgInfo
-rw-r--r-- mobile mobile ResourceRules.plist
drwxr-xr-x mobile mobile tmp /