View Full Version : file setPermission doesn't work appropriately in Win7 for different accounts

5th July 2011, 17:48
My program generates some txt config files. Each time running the program will read and modify this config file.

I am setting any user can read, write, excute this config file.

file.setPermissions(QFile::WriteOther | QFile::ReadOther | QFile::ExeOther);

Winxp works fine.

Now I am testing the program in Win7. I found that, by default only the creator can modify the config file, even as admin, the permission will be denied if not the creator.

This can be fixed by changing file property of course. But this is too annoy.
Any one know how to solve this in code?

Added after 21 minutes:

I read qt doc. The piece of code I posted only set for current user. So this won't help for non-creator users.
Win7 has more strict UAC rules...How can I solve this?:(

Added after 46 minutes:

For more information:
I have my cofig file saved in C:\Document and settings\All users\application data\
I think this is a suggested location to store config file.