[wxPython] $HOME - platform independent

Don't I recall some sort of user profile directory being
implemented in Win98 even for single user machines? I
thought it offered a login prompt and, if you cancelled
that, you're in as admin or some other such robustly
secure idea. ;p

I'm not as sure about Win98, but on Win95 you could optionally configure
user profiles, which allowed you to choose a user name on login.

I also understood that Windows NT, 2K, and ME have the
concept of user accounts, home directories, and so forth
as can be (and usually is) usually implemented at the
primary domain controller. If that's true, then it's
entirely reasonable to expect such settings be made even
on single-user machines; to plop them all into a global
file will make the admins at any well-run Windows site
insane and cause them to either jump through flaming hoops
to please the users or, more likely, refuse to install or
support the product.

Windows NT based operating systems implement

    %HOMEDRIVE and %HOMEPATH - very rarely set to anything
       other than C:\, even in domains. For practical purposes,
       useless, as C:\ is a hopeless default. (And as the default
       isn't user-specific, it's no use for user config files
       anyway).
    %USERPROFILE - difficult to manage as this is either a
       subdirectory of the Windows directory (nasty for security,
       backups, etc) or a directory name with spaces in (hard to
       manage from the command line). In either case, it is *not*
       the right place to put application config files - these can
       go in one of a number of *hidden* subdirectories of this,
       and hidden directories are almost impossible to work with in
       Windows :frowning:
    The registry - the "right" place, in some sense. Not a file-based
       interface, so needs non-portable handling. We've all heard
       enough complaints about the manageability of the regsitry, so
       I won't add more.

There is no standard. Even Microsoft programs use multiple, incompatible,
schemes, often changing even between versions.

Do whatever seems sensible, but don't make the mistake of assuming that
there is a standard. And don't think that users will appreciate you
inventing a new one for them. And trying to implement Unix standards on
Windows boxes will not sort this out - Windows users can be anti-Unix, just
as much as Unix users can be anti-Windows (and even experienced Windows
users with no axe to grind will point out that things *are* different, and
trying to make them the same won't work).

The nearest to a practical standard is to put *all* files related to an
application in one directory. Executables, config files, the lot. It's
multi-user hostile, but that isn't a practical issue in most cases. On
Windows, the unit of multi-user access is the network, not the machine.
Windows machines are usually only used by a single user, in practice.

It's not perfect, but it's pragmatic.

Oh, and by the way - most admins at Windows sites will cheerfully admit that
being insane is a requirement of the job :slight_smile:

--j, who doesn't support chaos just because it's the natural state
      of the universe.

But adding to the chaos by trying to make an apple look like an orange
doesn't help in any practical way...

Paul, who has seen too much of this mess to retain his sanity :slight_smile:

···

From: Jim Meyer [mailto:purp@wildbrain.com]

    The registry - the "right" place, in some sense. Not a file-based
       interface, so needs non-portable handling. We've all heard
       enough complaints about the manageability of the regsitry, so
       I won't add more.

Take a look at wxConfig. Be default it uses the Registry on Windows, or a
dot-file in the home dir on *nix. Nice, portable, simple.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Considering this and other non-GUI parts of the wxWindows/Python:
Do people use wxPython for non-GUI apps? Is is convenient to pick
out just these parts for a non GUI app?

I guess there is more useful stuff here for C++ programmers, with
wxString, wxDateTime, wxODBC, wxFile etc, but that most of these
things overlap standard or common extensions for Python.

It seems a bit silly to bundle wxPython in a non-GUI app just
for the config classes, but it does seem clever to have such a
platform independent thingie. I haven't seen such a library
for Python before (not that I looked). Is there one? Python obviously
has both ConfigParser and _winreg, but is there a common interface
to them?

···

At 08:47 2001-10-30 -0800, you wrote:

Take a look at wxConfig. Be default it uses the Registry on Windows, or a
dot-file in the home dir on *nix. Nice, portable, simple.

--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se

Wouldn't it be cleaner (on Windows) to have a "profiles"
    directory within the application directory and then
    have subdirectories within it named after users?
    
    This seems a little cleaner and easier to move around
    than messing with the Registry. Also helps if you're
    debugging your app and want to avoid inspecting
    the Registry all the time.

    Netscape 6, Mozilla, Wing IDE are programs that do
    something like this on Windows.
    
    Y.

···

On Tuesday, October 30, 2001 at 10:47:48 AM, Robin Dunn wrote:

    The registry - the "right" place, in some sense. Not a file-based
       interface, so needs non-portable handling. We've all heard
       enough complaints about the manageability of the regsitry, so
       I won't add more.

Take a look at wxConfig. Be default it uses the Registry on Windows, or a
dot-file in the home dir on *nix. Nice, portable, simple.

>> The registry - the "right" place, in some sense. Not a file-based
>> interface, so needs non-portable handling. We've all heard
>> enough complaints about the manageability of the regsitry, so
>> I won't add more.
>
> Take a look at wxConfig. Be default it uses the Registry on Windows, or

a

> dot-file in the home dir on *nix. Nice, portable, simple.

    Wouldn't it be cleaner (on Windows) to have a "profiles"
    directory within the application directory and then
    have subdirectories within it named after users?

    This seems a little cleaner and easier to move around
    than messing with the Registry. Also helps if you're
    debugging your app and want to avoid inspecting
    the Registry all the time.

    Netscape 6, Mozilla, Wing IDE are programs that do
    something like this on Windows.

There's no reason your app can't do something like that, just use
wxFileConfig everywhere. But the wx philosophy is "When in Rome do as the
romans do." IOW, when on platform X do it the X-way, when on platform Y do
it the Y-way. On windows the standard for configuration storage is to use
the registry. On *nix it is to use config files. Of course even in Rome
you are free to wear a seal skin parka and carry a harpoon if you really
want to, so it is with wx.

···

On Tuesday, October 30, 2001 at 10:47:48 AM, Robin Dunn wrote:

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

the real problem is -
I want to write a DEBUG-TRACE File user-dependent. And for this i can't use
the windows -Registry...

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Tuesday, October 30, 2001 11:12 PM
Subject: Re: Re[2]: [wxPython] $HOME - platform independent

> On Tuesday, October 30, 2001 at 10:47:48 AM, Robin Dunn wrote:
> >> The registry - the "right" place, in some sense. Not a file-based
> >> interface, so needs non-portable handling. We've all heard
> >> enough complaints about the manageability of the regsitry, so
> >> I won't add more.
> >
> > Take a look at wxConfig. Be default it uses the Registry on Windows,

or

a
> > dot-file in the home dir on *nix. Nice, portable, simple.
>
> Wouldn't it be cleaner (on Windows) to have a "profiles"
> directory within the application directory and then
> have subdirectories within it named after users?
>
> This seems a little cleaner and easier to move around
> than messing with the Registry. Also helps if you're
> debugging your app and want to avoid inspecting
> the Registry all the time.
>
> Netscape 6, Mozilla, Wing IDE are programs that do
> something like this on Windows.
>

There's no reason your app can't do something like that, just use
wxFileConfig everywhere. But the wx philosophy is "When in Rome do as the
romans do." IOW, when on platform X do it the X-way, when on platform Y

do

it the Y-way. On windows the standard for configuration storage is to use
the registry. On *nix it is to use config files. Of course even in Rome
you are free to wear a seal skin parka and carry a harpoon if you really
want to, so it is with wx.

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

the real problem is -
I want to write a DEBUG-TRACE File user-dependent. And for this i can't use
the windows -Registry...

Well, why didn't you say that at once? :wink:

I think the solution here is to put the traces in a directory under
the application directory. You can use wxGetUserName() or some other
method to get a user name, and either use that name in the file name,
or in the name of a subdirectory where you place the file. Actually,
regardless of platform, you can start by inquiring $HOME and use that
if it exists, and the directory under the application if it doesn't.

E.g. With $HOME set use $HOME/.myapp/debug.log

Without $HOME set use <APPLICATIONDIRECTORY>/users/<myusername>/debug.log

···

--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se

its a good idea -
but:
first: i think many users dont know their OWN-User Name in WinX Systems
second: maybe there is no write access to the APPLICATION FOLDER

thanks for your idea - i think i am going to use your idea.

···

----- Original Message -----
From: "Magnus Lyckå" <magnus@thinkware.se>
To: <wxpython-users@lists.wxwindows.org>
Sent: Wednesday, October 31, 2001 6:10 PM
Subject: Re: Re[2]: [wxPython] $HOME - platform independent

the real problem is -
I want to write a DEBUG-TRACE File user-dependent. And for this i can't use
the windows -Registry...

Well, why didn't you say that at once? :wink:

I think the solution here is to put the traces in a directory under
the application directory. You can use wxGetUserName() or some other
method to get a user name, and either use that name in the file name,
or in the name of a subdirectory where you place the file. Actually,
regardless of platform, you can start by inquiring $HOME and use that
if it exists, and the directory under the application if it doesn't.

E.g. With $HOME set use $HOME/.myapp/debug.log

Without $HOME set use <APPLICATIONDIRECTORY>/users/<myusername>/debug.log

--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

its a good idea -
but:
first: i think many users dont know their OWN-User Name in WinX Systems

I guess in a networked environment, there is no guarantee at
all that the login name returned by wxGetUserName() will be
unique over the network. It's obviously much worse to make
some kind od generic shrink-wrap product, than to make a
product which is supposed to work in a setting you know or
can influence...

One option is to use something similar to the behaviour
of Netscape on Windows, where you are prompted to make / select
a profile when you start the program.

second: maybe there is no write access to the APPLICATION FOLDER

In some kind of networked installation environment, it's probably
a good thing if one can point to some location of these settings
in some kind of ini-file. I think this is more problematic to do
with the registry...

···

At 12:07 2001-11-03 +0100, you wrote:

--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se