What's the perfect (OS independent) way of storing filepaths ?
Duncan Booth
duncan.booth at invalid.invalid
Mon Oct 20 06:20:06 EDT 2008
Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
> On Sun, 19 Oct 2008 15:40:32 +0000, Duncan Booth wrote:
>
>> Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
>>
>>> In Linux, config files should go into:
>>>
>>> ~/.<appname>/ or /etc/<appname>/
>>>
>>> In Windows (which versions?) then should go into the Documents And
>>> Settings folder, where ever that is.
>>>
>>> There's no single string which can represent both of these
>>> conventions!
>>
>> The first of those should do nicely for both Linux and Windows:
>>
>>>>> os.path.normpath(os.path.expanduser('~/.appname'))
>> 'C:\\Documents and Settings\\Duncan\\.appname'
>
>
> Except Windows users will be wondering why they have a directory
> starting with '.' in their home directory. Dot to make files hidden is
> not AFAIK supported by Windows.
>
The leading dot doesn't make the files hidden on Windows, but there's no
reason why you can't create files/folders with a leading dot and many
programs do just that. On the machine I'm on right now, 'dir .*' shows me:
Directory of C:\Documents and Settings\Duncan
18/10/2008 15:48 <DIR> .
18/10/2008 15:48 <DIR> ..
22/09/2008 20:28 45 .appcfg_nag
30/07/2004 09:28 244 .bashrc
18/01/2007 10:50 6,783 .bash_history
11/06/2006 12:30 <DIR> .borland
06/04/2004 15:43 365 .emacs-places
11/03/2004 12:34 <DIR> .emacs.d
08/01/2007 19:35 30,390 .fonts.cache-1
03/05/2008 18:07 <DIR> .gimp-2.0
14/01/2005 14:34 <DIR> .idlerc
11/06/2006 12:36 <DIR> .jbuilder2005
27/06/2005 12:44 3 .leoID.txt
11/06/2006 12:43 <DIR> .Nokia
11/06/2006 12:36 <DIR> .primetime2005
11/06/2006 12:13 <DIR> .qualitycentral
04/02/2004 12:24 <DIR> .ssh
12/08/2004 14:30 <DIR> .thumbnails
30/07/2004 14:11 49 .Xauthority
29/07/2004 16:25 12 .Xdefaults
29/07/2004 14:36 <DIR> .xemacs
17/08/2006 09:19 2,869 .XWinrc
not to mention the thousands of .svn folders scattered across the rest of
the system.
More information about the Python-list
mailing list