Reputation: 1578
I need to have the path after Document folder of my application.
Consider I have this path : myapp/sandbox/Documents/a/b/c/Documents/d/e/myfile.txt
.
I need a procedure to have this path: a/b/c/Documents/d/e/myfile.txt
.
How can I get the second path?
Upvotes: 2
Views: 173
Reputation: 5081
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString * path = [documentsDir stringByAppendingPathComponent:@"a/b/c/d/e/myfile.txt"];
Log this Path.
Try this code.
Upvotes: 1
Reputation: 736
// Try this
NSString * str_DocDirPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0] stringByAppendingPathComponent:@"a/b/c/d/e/myfile.txt"];
Upvotes: 3