What's the perfect (OS independent) way of storing filepaths ?
steve at REMOVE-THIS-cybersource.com.au
Mon Oct 20 15:41:09 CEST 2008
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
>>> The first of those should do nicely for both Linux and Windows:
>>> '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
And 75%  of average Windows users will either delete the file, move it
to a more convenient location, or edit the file name to remove the dot.
I'm not saying you can't use files with a leading period under Windows.
You can name all your config files using Morse code if you want. I'm
saying it breaks the expected Windows file location guidelines, and it
displays a shameful lack of care by the programmer. Windows users are
more forgiving of badly behaved programs than Macintosh users, but even
so, it's pretty shoddy to ignore a platform's standard file locations.
Unix/Linux coders would rightly be annoyed if some tool created a
directory "/Program Files" instead of using the appropriate /bin
directory. This is no different.
 Based on my experience of the typical Windows user. YMMV.
 And they are right to do so. Programs that dump config files and
directories, hidden or not, in the top level of the user's home directory
are incredibly rude. It may have been a Unix standard for as long as
there has been a Unix, but it's still the programming equivalent of
coming into somebody's house and throwing your tools all over their
living room floor.
More information about the Python-list