зеркало из https://github.com/mono/mail-archives.git
101 строка
3.4 KiB
HTML
101 строка
3.4 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<TITLE> [Mono-osx] OSX vs Linux
|
||
|
</TITLE>
|
||
|
<LINK REL="Index" HREF="index.html" >
|
||
|
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20OSX%20vs%20Linux&In-Reply-To=47724CF5283C94439900996CDF98D5BE791DB5%40igtdalexc002.corp.ignitetech.com">
|
||
|
<META NAME="robots" CONTENT="index,nofollow">
|
||
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
||
|
<LINK REL="Previous" HREF="001093.html">
|
||
|
<LINK REL="Next" HREF="001094.html">
|
||
|
</HEAD>
|
||
|
<BODY BGCOLOR="#ffffff">
|
||
|
<H1>[Mono-osx] OSX vs Linux</H1>
|
||
|
<B>Miguel de Icaza</B>
|
||
|
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20OSX%20vs%20Linux&In-Reply-To=47724CF5283C94439900996CDF98D5BE791DB5%40igtdalexc002.corp.ignitetech.com"
|
||
|
TITLE="[Mono-osx] OSX vs Linux">miguel at novell.com
|
||
|
</A><BR>
|
||
|
<I>Mon Dec 17 19:03:46 EST 2007</I>
|
||
|
<P><UL>
|
||
|
<LI>Previous message: <A HREF="001093.html">[Mono-osx] OSX vs Linux
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="001094.html">[Mono-osx] OSX vs Linux
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#1099">[ date ]</a>
|
||
|
<a href="thread.html#1099">[ thread ]</a>
|
||
|
<a href="subject.html#1099">[ subject ]</a>
|
||
|
<a href="author.html#1099">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
<HR>
|
||
|
<!--beginarticle-->
|
||
|
<PRE>Hello,
|
||
|
|
||
|
><i> I'm having some trouble distinguishing the difference between Linux and
|
||
|
</I>><i> OSX.
|
||
|
</I>
|
||
|
Oh.
|
||
|
|
||
|
><i>From the subject line I felt a new flame war was brewing.
|
||
|
</I>
|
||
|
The uname approach works, the following is a piece of uname that uses
|
||
|
P/Invoke instead of depending on uname, its part of mkbundle.cs:
|
||
|
|
||
|
using System.Runtime.InteropServices;
|
||
|
|
||
|
[DllImport ("libc")]
|
||
|
static extern int uname (IntPtr buf);
|
||
|
|
||
|
static void DetectOS ()
|
||
|
{
|
||
|
if (!IsUnix) {
|
||
|
Console.WriteLine ("OS is: Windows");
|
||
|
style = "windows";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
IntPtr buf = UnixMarshal.AllocHeap(8192);
|
||
|
if (uname (buf) != 0){
|
||
|
Console.WriteLine ("Warning: Unable to detect OS");
|
||
|
return;
|
||
|
}
|
||
|
string os = Marshal.PtrToStringAnsi (buf);
|
||
|
Console.WriteLine ("OS is: " + os);
|
||
|
if (os == "Darwin")
|
||
|
style = "osx";
|
||
|
|
||
|
UnixMarshal.FreeHeap(buf);
|
||
|
}
|
||
|
|
||
|
static bool IsUnix {
|
||
|
get {
|
||
|
int p = (int) Environment.OSVersion.Platform;
|
||
|
return ((p == 4) || (p == 128));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</PRE>
|
||
|
|
||
|
<!--endarticle-->
|
||
|
<HR>
|
||
|
<P><UL>
|
||
|
<!--threads-->
|
||
|
<LI>Previous message: <A HREF="001093.html">[Mono-osx] OSX vs Linux
|
||
|
</A></li>
|
||
|
<LI>Next message: <A HREF="001094.html">[Mono-osx] OSX vs Linux
|
||
|
</A></li>
|
||
|
<LI> <B>Messages sorted by:</B>
|
||
|
<a href="date.html#1099">[ date ]</a>
|
||
|
<a href="thread.html#1099">[ thread ]</a>
|
||
|
<a href="subject.html#1099">[ subject ]</a>
|
||
|
<a href="author.html#1099">[ author ]</a>
|
||
|
</LI>
|
||
|
</UL>
|
||
|
|
||
|
<hr>
|
||
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
|
||
|
mailing list</a><br>
|
||
|
</body></html>
|