Re: Windows User path

Jeremy Bowers <[email protected]> Mon, 29 Mar 2004 09:37:47 -0500
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <[email protected]>
Georg Bauer wrote:
> Hi!
> 
> 
>>The only environment variable that I set is HOME, in the PyDS startup
>>script(Windows batch file):
> 
> 
> The PyDS code does some path magic to find the place where the .PyDS
> directory (that I named .Toolserver accidently, because I was mentally
> in the wrong project ;-) ) should stay. They  use %HOMEDRIVE% and
> %HOMEDIR% (or was it %HOMEPATH%?) to find what under Unix would be just
> $HOME, the users home directory. %USERPROFILE% is a standard environment
> variable that points to c:\system\Profiles\USERNAME - so it's something
> that is user specific.

Would it be acceptable to abstract this "path magic" out into a module 
for distribution under the Python license? People keep wanting this, and 
it's non-trivial to get it right in Windows, but I can't seem to find 
any seperate module online, even though I know I've seen a lot of call 
for it, including from me.

I'm thinking a module that tries to get as many OS's right as possible, 
not just windows.

If I understand my Windows correctly, the "most proper" way to get the 
user's home directory is via the Registry, but not all Python Windows 
installs can get at the Registry correctly, so you'd want the current 
logic as backup. (You could try to import the registry tools from Mark 
Hammond's stuff and detect the failure.)

I have another project that will be interested in this and it would be 
good to just get it out there. I'm willing to be responsible for it; I'd 
probably put it up on Sourceforge. (Except they obstinately refuse to 
email me a confirmation email for my account, so that may not work.)

I'd like permission to release under the Python license, rather then the 
GPL, in the hopes that it may someday get included in the main distro. 
(It's too small to be worth the GPL, IMHO.)