On 31-Oct-2003, Chris Seaton <[EMAIL PROTECTED]> wrote:
> On Fri, 2003-10-31 at 01:29, Fergus Henderson wrote:
> > On 29-Oct-2003, Chris Seaton <[EMAIL PROTECTED]> wrote:
> > > How do I know what OS my program is running on at run time?
> > 
> > Why do you care?
> 
> To select between GTK# and SWF.

I can quite easily imagine systems on which both are supported.

I would suggest something like this:

        bool prefer_gtk;        // set by command-line option
                                // or environment variable

        if (prefer_gtk)
                try {
                        code to use GTK#;
                } catch (GTK# not availabe) {
                        code to use SWF;
                }
        } else {
                try {
                        code to use SWF;
                } catch (SWF not availabe) {
                        code to use GTK#;
                }
        }

You can do this just for the first call, and save the results in a
variable which you then use to decide which GUI to use for later calls.

It would be reasonable to use the OS setting to determine the default
value of prefer_gtk.  But you should definitely try both, regardless of
which OS the platform claims to be.

-- 
From: Fergus Henderson <[EMAIL PROTECTED]>
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to