Saving app data
-
Hi lovely people,
I've been working on a QML + python app & want to save some data as described in http://docs.ubports.com/en/latest/appdev/guides/writeable-dirs.html. However I get a PermissionError trying to access /home/phablet/.local/share/<myappname>. Is there an AppArmor policy I should add or is there something else I'm missing?
Thanks in advance, Bambi
-
Hi @bambi, welcome to the forums.
Are you using the provided functions to retrieve the directory names or are you using a hardcoded string?
-
@bambi
Have you check for the common mistake while using AppArmore ?
After any AppArmor modification you have to increase the version number in order to the changes to apply. -
@arubislander Thanks! I used a hardcoded string because im trying to access the folder from python. Maybe that's a bad idea? I'll try it from qml with the function (when i can, laptop broke last night) to see if that works and otherwise post code+error
-
@AppLee Yes, did that, thanks for the response!
-
@bambi The path would be
${HOME}/.local/share/${APP_PKG_NAME}so if your name isforest.bambifor example, it would end up as/home/phablet/.local/share/forest.bambias the directory path.You will also need to first create the directory before you can create any files inside it.
-
@dobey Thanks for the response! Turns out the mistake I made was changing the applicationName in MainView a while back, forgetting about it and copying that into the path instead of the name in manifest.json.in. They are the same now & can create the folder

-
@bambi I have been bitten by this before and it took me forever to figure out that it is my responsibility to maintain this id in multiple places. I wonder whether there is a way to remove this headache and have only one single place to specify it making it impossible to forget that other place. or if we cant have a single truth, maybe at least get something to warn app developers when they changed one but not the other....
-
@doniks A warning has already been added (recently I think)

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register Login