[wxPython-users] [OT] Home dir under Windows?
Rune Devik
rune.devik at gmail.com
Thu Oct 26 07:45:33 PDT 2006
Depends on if you want the directory stated by the %HOME% env var or if you
want the "windows home dir" which is something like c:\documents and
settings\<username>.
The first is easy:
import os
if "HOME" in os.environ:
print os.environ["HOME"]
else:
print "home is not defined"
The second one is all about asking the registry. Example code can be found
here were all "user" folders are extracted from the registry:
http://launcher.cvs.sourceforge.net/launcher/launcher/src/ShellFolders.py?r=
evision=3D1.1.1.1&view=3Dmarkup
save that file and use it like this to display all user specific folders:
from ShellFolders import fetchShellFolders
folders =3D fetchShellFolders()
for key in folders.keys():
print "%s: %s" % (key, folders[key])
Hope this helps,
-- =
Rune Devik
http://www.garageinnovation.org
On 10/26/06, Basil Shubin <bashu at yandex.ru> wrote:
>
> Hi, friends!
>
> Excuse me for offtopic :-)
>
> Under posix compatible OSes I can acquire path to user home dir by:
> os.path.expanduser('~')
>
> and how I can achieve the same thing under Windows 2000/XP?
>
> --
> Basil Shubin
> Freelance Software Developer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200610=
26/0ef87ac7/attachment.htm
More information about the wxpython-users
mailing list