As pointed out in Writing config file in C:\Program Files (x86)\MyApp\myapp.cfg, vs. Administrator privilege, it is not a good idea to write a config file in C:\Program Files (x86)\MyApp\myapp.cfg.
Instead of this, my software now saves its data in a subdir of %ALLUSERSPROFILE% (ex : C:\ProgramData\MyApp\myapp.cfg on Win7)
[I use myfile = open(filename, 'a') in Python to do this.]
I now encounter an issue about this file :
- I installed the software with
User A, and ran it, then the fileC:\ProgramData\MyApp\myapp.cfgwas written. - Then, I changed user to
User B, and ran my software again : now an error is displayed :User 2has no right to write inC:\ProgramData\MyApp\myapp.cfg(Permission denied).
Why? Isn't %ALLUSERSPROFILE% a place that can be written by all users?
How to solve this problem ?