[SailfishDevel] Folder permissions

Ove Kåven ovek at arcticnet.no
Sun Mar 9 19:01:57 UTC 2014


Den 09. mars 2014 18:33, skrev Iosif Hamlatzis:
> When deploying a game/application where should its resources
> (images/sounds/settings files) be stored so that the game/application
> can have both read and write permissions?

You should clarify why you need write permissions, so that it's possible 
to suggest the best way to handle your situation. In general, files 
distributed as part of the rpm should never be written to.

If it's only things like config files or high scores that you need to 
write, then there's standard ways to do it. They should be placed into 
the user's home directory on first startup of your game, either by being 
created from scratch, or by copying an initial version from your 
/usr/share directory. (But don't hardcode /home. The best way to get the 
path is to use QStandardPaths::writableLocation.)

> I tried to use the /usr/share/$$(TARGET) folder where $$(TARGET) is the
> name of my game but it seams the game doesn't have permissions on this
> folder. Not even read permissions.

No, you should have read permissions. You just can't write.

> I use:
>
> FILE* pFile = fopen("/usr/share/MyGame/Home/settings.bin", "r+b");

That's not read permissions, You're asking for *both* read and write 
permissions, which is denied because you can only have read permissions, 
not write. To request read permissions only, use just "rb", not "r+b".



More information about the Devel mailing list