зеркало из https://github.com/mono/mail-archives.git
103 строки
3.9 KiB
HTML
103 строки
3.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] Determining the platform at compile and run time
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:jonpryor%40vt.edu">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="016667.html">
|
|
<LINK REL="Next" HREF="016668.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] Determining the platform at compile and run time
|
|
</H1>
|
|
<B>Jonathan Pryor
|
|
</B>
|
|
<A HREF="mailto:jonpryor%40vt.edu"
|
|
TITLE="[Mono-list] Determining the platform at compile and run time">jonpryor@vt.edu
|
|
</A><BR>
|
|
<I>Fri, 31 Oct 2003 07:07:03 -0500</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="016667.html">[Mono-list] Determining the platform at compile and run time
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016668.html">[Mono-list] Determining the platform at compile and run time
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16679">[ date ]</a>
|
|
<a href="thread.html#16679">[ thread ]</a>
|
|
<a href="subject.html#16679">[ subject ]</a>
|
|
<a href="author.html#16679">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Just to continue Fergus' line of reasoning, Type Reflector (CVS module:
|
|
type-reflector) does the same thing. It has three different front-ends
|
|
(Gtk#, System.Windows.Forms, and Console), that you can select by using
|
|
either a command-line argument (--displayer=NAME) or by setting an
|
|
option on the type-reflector.exe.config file.
|
|
|
|
Actually, the .config file supports an ordering of preferred front-ends,
|
|
so that it will try each one, in order, until it finds one that works.
|
|
|
|
- Jon
|
|
|
|
On Thu, 2003-10-30 at 22:44, Fergus Henderson wrote:
|
|
><i> On 31-Oct-2003, Chris Seaton <<A HREF="mailto:chris@chrisseaton.com">chris@chrisseaton.com</A>> wrote:
|
|
</I>><i> > On Fri, 2003-10-31 at 01:29, Fergus Henderson wrote:
|
|
</I>><i> > > On 29-Oct-2003, Chris Seaton <<A HREF="mailto:chris@chrisseaton.com">chris@chrisseaton.com</A>> wrote:
|
|
</I>><i> > > > How do I know what OS my program is running on at run time?
|
|
</I>><i> > >
|
|
</I>><i> > > Why do you care?
|
|
</I>><i> >
|
|
</I>><i> > To select between GTK# and SWF.
|
|
</I>><i>
|
|
</I>><i> I can quite easily imagine systems on which both are supported.
|
|
</I>><i>
|
|
</I>><i> I would suggest something like this:
|
|
</I>><i>
|
|
</I>><i> bool prefer_gtk; // set by command-line option
|
|
</I>><i> // or environment variable
|
|
</I>><i>
|
|
</I>><i> if (prefer_gtk)
|
|
</I>><i> try {
|
|
</I>><i> code to use GTK#;
|
|
</I>><i> } catch (GTK# not availabe) {
|
|
</I>><i> code to use SWF;
|
|
</I>><i> }
|
|
</I>><i> } else {
|
|
</I>><i> try {
|
|
</I>><i> code to use SWF;
|
|
</I>><i> } catch (SWF not availabe) {
|
|
</I>><i> code to use GTK#;
|
|
</I>><i> }
|
|
</I>><i> }
|
|
</I>><i>
|
|
</I>><i> You can do this just for the first call, and save the results in a
|
|
</I>><i> variable which you then use to decide which GUI to use for later calls.
|
|
</I>><i>
|
|
</I>><i> It would be reasonable to use the OS setting to determine the default
|
|
</I>><i> value of prefer_gtk. But you should definitely try both, regardless of
|
|
</I>><i> which OS the platform claims to be.
|
|
</I>
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="016667.html">[Mono-list] Determining the platform at compile and run time
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016668.html">[Mono-list] Determining the platform at compile and run time
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16679">[ date ]</a>
|
|
<a href="thread.html#16679">[ thread ]</a>
|
|
<a href="subject.html#16679">[ subject ]</a>
|
|
<a href="author.html#16679">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|