aakpro
aakpro

Reputation: 1578

Getting path after document folder in ios development

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

Answers (2)

Jitendra
Jitendra

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

Lokesh Chowdary
Lokesh Chowdary

Reputation: 736

// Try this

NSString * str_DocDirPath  = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0] stringByAppendingPathComponent:@"a/b/c/d/e/myfile.txt"];

Upvotes: 3

Related Questions