Home directory problem
Mike C. Fletcher
mcfletch at rogers.com
Mon Jun 9 13:42:49 EDT 2003
This is the kind of thing that should really be in a module in the
standard library, with lots of testing/collaboration establishing a
robust solution. I don't really have time to build such a thing, but
here's a start that might help someone else work it up (attached).
Notes:
On Win32 you're not supposed to dump data into the user's
profile/home directory, you're supposed to use a sub-directory in the
AppData directory (or the Local App Data directory for non-roaming apps).
I haven't tested the module on Linux, but it's pretty simplistic on
that side.
I'd rather see the seperate mechanisms for finding directories
broken out into seperate functions for easier testing/verification/reuse.
There should really be mechanisms for retrieving the other
shell-folder types (e.g. ttf font directories, profile directories,
desktop directories, menu directories, in other words, a cross-platform
version of Win32's SHGetFolderPath would be nice :) .
Oh well, it's a quick hack, you get what you pay for :) .
HTH,
Mike
Nagy László Zsolt wrote:
> Hi All! I wonder if there is a standard way to determine a user's
> local directory. I know that unix compatible machines has an
> enviroment variable called 'HOME'. Windows 2000 and XP machines have
> an enviroment variable called 'HOMEPATH'. But I don't know how to read
> this on Win9X, Mac and the possible others. Is there a standard way?
> Some details: I'm writting a multi platform two-tiered source code
> management tool. The clients need to store some information locally.
> This information must be separated from other users. I'm using dumbdbm
> and I'm searching the right place for the config database. Any ideas?
> Thanks in advance.
>
> Laci 1.0
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: homedirectory.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20030609/2652b0fa/attachment.ksh>
More information about the Python-list
mailing list