[Mono-dev] [PATCH] System.Windows.Forms.Mime: Use freedesktop.org only on Unix platforms.

Vincent Povirk madewokherd at gmail.com
Tue Mar 29 15:02:35 EDT 2011


This shouldn't be used in an environment like Wine, where the FDO mime
files of a real Windows system can be accessed.
-------------- next part --------------
From f08711c13f10237d56b29e5fd5f95b8be70ce90f Mon Sep 17 00:00:00 2001
From: Vincent Povirk <madewokherd at gmail.com>
Date: Tue, 29 Mar 2011 13:59:09 -0500
Subject: [PATCH] System.Windows.Forms.Mime: Use freedesktop.org only on Unix platforms.

---
 .../System.Windows.Forms/Mime.cs                   |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs
index f317c0a..3accd85 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Mime.cs
@@ -645,6 +645,11 @@ namespace System.Windows.Forms
 		
 		public int Init ()
 		{
+			int p = (int) Environment.OSVersion.Platform;
+			if ((p != 4) && (p != 6) && (p != 128))
+				// Not running on Unix.
+				return -1;
+
 			CheckFDOMimePaths ();
 			
 			if (!fdo_mime_available)
-- 
1.7.2.5


More information about the Mono-devel-list mailing list