You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2007/08/21 22:51:03 UTC

svn commit: r568274 - /incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs

Author: aroush
Date: Tue Aug 21 13:51:02 2007
New Revision: 568274

URL: http://svn.apache.org/viewvc?rev=568274&view=rev
Log:
Fix: LUCENENET-62 "IndexReader.IndexExists() Fails if directory doesn't exists."

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/IndexReader.cs?rev=568274&r1=568273&r2=568274&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs Tue Aug 21 13:51:02 2007
@@ -405,7 +405,14 @@
 		
 		public static bool IndexExists(System.IO.FileInfo directory)
 		{
-			return SegmentInfos.GetCurrentSegmentGeneration(System.IO.Directory.GetFileSystemEntries(directory.FullName)) != - 1;
+            if (System.IO.Directory.Exists(directory.FullName))
+            {
+                return SegmentInfos.GetCurrentSegmentGeneration(System.IO.Directory.GetFileSystemEntries(directory.FullName)) != - 1;
+            }
+            else
+            {
+                return false;
+            }
 		}
 		
 		/// <summary> Returns <code>true</code> if an index exists at the specified directory.