"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote:
> On Thu, 03 Aug 2006 21:55:21 +0200, Jarek Zgoda <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> crystalattice napisa?(a):
>>
>> > If I want to make sure the file/directory is made in a user's home
>> > directory (e.g. /home/users/path/to/file) but also compatible w/
>> > Windows, how would I rewrite this (if required)?
>>
>> On Windows, there's no notion of user's home directory, there is a
>> directory for user's profile that is treated as $HOME but isn't
>> (%USERPROFILE%), something that looks like $HOME, bot in fact is not
>> (%HOMEDRIVE% + %HOMEPATH%) and many other mess. Microsoft suggests using
>> %USERPROFILE%, but they do not specify desired behaviour, when
>> %USERPROFILE% == c:\.
>
> There is also the registry entry
>
> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
> Folders\Personal
>
> which, on my machine, contains the value
>
> E:\UserData\Dennis Lee Bieber\My Documents

According to this:
http://blogs.msdn.com/oldnewthing/archive/2003/11/03/55532.aspx
the Shell Folders key shouldn't be relied upon.
You can retrieve user directories using SHGetFolderPath
or SHGetSpecialFolderPath, both of which are wrapped by
win32com.shell.

     Roger



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to