iOS Documents directory

I’m using SDL_GetPrefPath to get the path to a ‘writable’ directory on iOS . Whilst this works, it would be more useful for my app to get the path to its Documents directory which - as well as being writable - can be shared and ‘seen’ from outside using a USB link to a PC or Mac.

By inspection, I can see that the Documents directory can be reached relative to the path returned by SDL_GetPrefPath using ../../Documents but that’s on a specific device running a specific version of iOS.

Is there a way, using SDL, to discover the path to the app’s Documents directory in a way that will work irrespective of the device or version of iOS?

I didn’t look if SDL supports this nowadays, but some years ago I did this using Objective-C. I had some other stuff too that was not supported by SDL in a separate Objective-C file that I only compile for iOS. It’s very easy to call Objective-C from C/C++ (unlike calling Java).


Thanks. I must admit I’m tempted to risk a simpler method. According to Apple’s own docs the Documents directory sits alongside the Library directory in the app’s sandbox, and Library is on the path returned by SDL_GetPrefPath. So I’m hoping it will be reasonably safe to assume the relationship always holds (especially as my app is 64-bits so targets only relatively recent versions of iOS) and set the Documents path by a simple string substitution. If this comes unstuck I’ll have only myself to blame!