beagle r4883 - trunk/beagle/Filters



Author: dbera
Date: Sat Nov 22 20:27:25 2008
New Revision: 4883
URL: http://svn.gnome.org/viewvc/beagle?rev=4883&view=rev

Log:
.desktop files can have empty lines before the [Desktop Entry] group. Deal with such files. Fixes #544607.
Actually, .desktop file format is pretty flexible - our parser will reject most of the uncommon but valid files. The best solution is to rewrite it using GKeyFiles.


Modified:
   trunk/beagle/Filters/FilterDesktop.cs

Modified: trunk/beagle/Filters/FilterDesktop.cs
==============================================================================
--- trunk/beagle/Filters/FilterDesktop.cs	(original)
+++ trunk/beagle/Filters/FilterDesktop.cs	Sat Nov 22 20:27:25 2008
@@ -69,18 +69,23 @@
 				Error ();
 				return;
 			}
+			
+			string line;
+
+			// FIXME: Use GKeyFile to parse .desktop files (which are like .ini files)
+			// Find the [Desktop Entry] group
+			while ((line = reader.ReadLine ()) != null)
+				if (line == "[Desktop Entry]") break;
 
-			if (reader.ReadLine () != "[Desktop Entry]") {
-				Logger.Log.Error ("Could not filter file: No desktop entry");
-				reader.Close ();
+			if (line == null) {
+				Logger.Log.Error ("Could not filter: No group [Desktop Entry]");
 				Error ();
 				return;
 			}
-			
+
 			// desktop files must have a name
 			bool have_name = false;
 			
-			String line;
 			while ((line = reader.ReadLine ()) != null)  {
 				string [] sline = line.Split ('=');
 				if (sline.Length != 2)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]