Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access iPhone's sandbox Document folder from standard C++ code

I'm deploying an iphone application through QtCreator. I'd like to create a simple file using standard C++ libraries. I try to do this in the sandbox Documents folder.

I compiled boost, so I use this library to check if the sandbox Document folder exists.

My application starts in /private/var/mobile/Containers/Bundle/Application/<UUID>/<application name>.app. Then, I simply try to access /private/var/mobile/Containers/Bundle/Application/<UUID>/<application name>.app/../Documents folder (using boost::filesystem::is_directorty), as it does not exist, I try to create it (using boost::filesystem::create_directories), but it fails (boost raises an exception).

Am I doing it wrong? Am I not in the right PATH? Or do I have to set any special permission to my app in order to be able to do this (as for Android, I add to list EXTERNAL_STORAGE in my application manifest).

like image 892
jpo38 Avatar asked Aug 12 '26 11:08

jpo38


1 Answers

My path for documents was wrong. Could find the good one using Qt API:

QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);

This returns:

/var/mobile/Containers/Data/Application/<another UUID>/Documents

(different than what I was trying to access in /private/var/mobile/Containers/Bundle/Application)

like image 144
jpo38 Avatar answered Aug 15 '26 04:08

jpo38



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!