views:

41

answers:

2

How do I get the current working directory's absolute path on the iPhone using Objective-C?

A: 

I'm afraid that you can't get the absolute path on device, at least with official SDK. Please make me correct if I'm wrong.

taskinoor
A: 

Not sure whether this works on iPhone, but it should.

char *buf = getwd();
NSString *cwd = [NSString stringWithCString:buf encoding:NSUnicodeStringEncoding];
free(buf);

You might need to fiddle with the right encoding...

EDIT: aaaehm, you might also just want to try NSFileManager's currentDirectoryPath method...

Max Seelemann