User preference file in Win32

Gerhard Häring gerhard.nospam at bigfoot.de
Fri Aug 24 20:40:51 CEST 2001


On Fri, 24 Aug 2001 13:21:24 -0400 (EDT), Ignacio Vazquez-Abrams wrote:
>On Fri, 24 Aug 2001, Gillou wrote:
>
>> Hi,
>>
>> Sorry, this is not 100% Pythonic question, but as I'm in process to write a
>> Unix/Win32 app.
>> I need to know where it's usual to store user preference (not in a registry
>> please) files for an app for Win32 applications (98,ME,NT,2000) as in Unix,
>> we may use something like "~/.myapp.conf"

I think there is no easy way to get this right on all flavours of win32. Every
win32 implementation seems to have its own idea of how to do this. 

I can tell you how to do it on Windows 2000:

The following registry keys refer to directories where programs can store their
configuration data. You normally create a subdirectory
"{companyname}/{productname}" in this directory. I'd use the second registry
key (...\Shell Folders\AppData).

HKEY_CURRENT_USER\Volatile Environment -> APPDATA
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
    Shell Folders -> AppData
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
    Shell Folders -> Local AppData 

This doesn't work on NT4, however. And the GUIs on top of DOS are entirely
different again.

>You have to create a private directory under 'Local Settings' under the users
>profile directory.

This would have been the Windows 2000 case.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list