What's the perfect (OS independent) way of storing filepaths ?

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Tue Oct 21 11:17:31 CEST 2008


Steven D'Aprano schreef:
> On Mon, 20 Oct 2008 10:20:06 +0000, Duncan Booth wrote:
> 
>> 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:
> [snip]
> 
> And 75% [1] of average Windows users will either delete the file, move it 
> to a more convenient[2] location, or edit the file name to remove the dot.

I don't think so: the average Windows user will never even see the files 
in that directory; they only see the files in the 'Desktop' and 'My 
Documents' folders.

-- 
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
   -- Isaac Asimov

Roel Schroeven



More information about the Python-list mailing list