nemo r18 - in trunk: . metadata



Author: arj
Date: Mon Jan  7 10:34:51 2008
New Revision: 18
URL: http://svn.gnome.org/viewvc/nemo?rev=18&view=rev

Log:
Optimizations in metadata store



Modified:
   trunk/NEWS
   trunk/metadata/MetadataStore.cs

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Jan  7 10:34:51 2008
@@ -4,6 +4,7 @@
 - Support Beagle through the Xesam adaptor
 - Fix indexing so it doesn't kill the machine
 - Fix bug that caused a crash in metadata store
+- Optimize metadata store to be faster at checking for valid files
 
 0.1.2 alpha
 -----------

Modified: trunk/metadata/MetadataStore.cs
==============================================================================
--- trunk/metadata/MetadataStore.cs	(original)
+++ trunk/metadata/MetadataStore.cs	Mon Jan  7 10:34:51 2008
@@ -151,10 +151,17 @@
 		// workaround braindead filter interface on FileSystemWatcher
 		private bool filename_is_good(string filename)
 		{
+			foreach (string v in exclude_dirs)
+				if (filename.Contains(v))
+					return false;
+
 			bool found = false;
 
+			int index = filename.LastIndexOf('.');
+			string extension = index != -1 ? filename.Substring(index) : ""; 
+
 			foreach (string v in includes)
-				if (filename.EndsWith(v)) {
+				if (extension == v) {
 					found = true;
 					break;
 				}
@@ -163,13 +170,9 @@
 				return false;
 				
 			foreach (string v in excludes)
-				if (filename.EndsWith(v))
+				if (extension == v)
 					return false;
 	
-			foreach (string v in exclude_dirs)
-				if (filename.Contains(v))
-					return false;
-
 			// regex slow
 			// return include_regex.IsMatch(filename) && !exclude_regex.IsMatch(filename);
 



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