From 52f04d5a617f9df7e58f9653d52aaafd26b5c484 Mon Sep 17 00:00:00 2001
From: Martin Baulig <martin@novell.com>
Date: Fri, 11 Oct 2002 15:41:49 +0000
Subject: [PATCH] 2002-10-11  Martin Baulig  <martin@gnome.org>

	* glib/FileUtils.cs: New file.  Wrapped g_file_get_contents() here.

svn path=/trunk/gtk-sharp/; revision=8167
---
 ChangeLog         |  4 ++++
 glib/FileUtils.cs | 29 +++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 glib/FileUtils.cs

diff --git a/ChangeLog b/ChangeLog
index 7b0126e7d..1a9f1a351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-10-11  Martin Baulig  <martin@gnome.org>
+
+	* glib/FileUtils.cs: New file.  Wrapped g_file_get_contents() here.
+
 2002-10-10  Mike Kestner <mkestner@speakeasy.net>
 
 	* generator/CallbackGen.cs : some fixes
diff --git a/glib/FileUtils.cs b/glib/FileUtils.cs
new file mode 100644
index 000000000..85901525c
--- /dev/null
+++ b/glib/FileUtils.cs
@@ -0,0 +1,29 @@
+// GLib.FileUtils.cs - GFileUtils class implementation
+//
+// Author: Martin Baulig <martin@gnome.org>
+//
+// (c) 2002 Ximian, Inc
+
+namespace GLib {
+
+	using System;
+	using System.Text;
+	using System.Runtime.InteropServices;
+
+	public class FileUtils
+	{
+		[DllImport("glib-2.0")]
+		extern static bool g_file_get_contents (string filename, out IntPtr contents, out int length, out IntPtr error);
+
+		public static string GetFileContents (string filename)
+		{
+			int length;
+			IntPtr contents, error;
+
+			if (!g_file_get_contents (filename, out contents, out length, out error))
+				throw new GException (error);
+
+			return Marshal.PtrToStringAnsi (contents, length);
+		}
+	}
+}