You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by cc...@apache.org on 2011/11/17 04:49:34 UTC
[Lucene.Net] svn commit: r1203041 [2/2] - in
/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/
src/core/Analysis/Tokenattributes/ src/core/Index/ src/core/Search/
src/core/Store/ src/core/Support/ src/core/Util/ test/core/
test/core/Index/ test/core/...
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/_TestUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/_TestUtil.cs?rev=1203041&r1=1203040&r2=1203041&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/_TestUtil.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/_TestUtil.cs Thu Nov 17 03:49:32 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.IO;
using Lucene.Net.Support;
using NUnit.Framework;
@@ -42,57 +43,59 @@ namespace Lucene.Net.Util
return new System.IO.DirectoryInfo(System.IO.Path.Combine(tempDir, desc + "." + (new System.Random()).Next(System.Int32.MaxValue)));
}
- // TODO: This is a bit overkill? -cc
+ // TODO: This was a bit overkill? -cc
public static void RmDir(System.IO.DirectoryInfo dir)
- {
- bool tmpBool;
- if (System.IO.File.Exists(dir.FullName))
- tmpBool = true;
- else
- tmpBool = System.IO.Directory.Exists(dir.FullName);
- if (tmpBool)
- {
- System.IO.FileInfo[] files = FileSupport.GetFiles(dir);
- for (int i = 0; i < files.Length; i++)
- {
- bool tmpBool2;
- if (System.IO.File.Exists(files[i].FullName))
- {
- System.IO.File.Delete(files[i].FullName);
- tmpBool2 = true;
- }
- else if (System.IO.Directory.Exists(files[i].FullName))
- {
- System.IO.Directory.Delete(files[i].FullName);
- tmpBool2 = true;
- }
- else
- tmpBool2 = false;
- if (!tmpBool2)
- {
- throw new System.IO.IOException("could not delete " + files[i]);
- }
- }
- bool tmpBool3;
- if (System.IO.File.Exists(dir.FullName))
- {
- System.IO.File.Delete(dir.FullName);
- tmpBool3 = true;
- }
- else if (System.IO.Directory.Exists(dir.FullName))
- {
- System.IO.Directory.Delete(dir.FullName);
- tmpBool3 = true;
- }
- else
- tmpBool3 = false;
- bool generatedAux = tmpBool3;
- }
- }
+ {
+ RmDir(dir.FullName);
+ //bool tmpBool;
+ //if (System.IO.File.Exists(dir.FullName))
+ // tmpBool = true;
+ //else
+ // tmpBool = System.IO.Directory.Exists(dir.FullName);
+ //if (tmpBool)
+ //{
+ // System.IO.FileInfo[] files = FileSupport.GetFiles(dir);
+ // for (int i = 0; i < files.Length; i++)
+ // {
+ // bool tmpBool2;
+ // if (System.IO.File.Exists(files[i].FullName))
+ // {
+ // System.IO.File.Delete(files[i].FullName);
+ // tmpBool2 = true;
+ // }
+ // else if (System.IO.Directory.Exists(files[i].FullName))
+ // {
+ // System.IO.Directory.Delete(files[i].FullName);
+ // tmpBool2 = true;
+ // }
+ // else
+ // tmpBool2 = false;
+ // if (!tmpBool2)
+ // {
+ // throw new System.IO.IOException("could not delete " + files[i]);
+ // }
+ // }
+ // bool tmpBool3;
+ // if (System.IO.File.Exists(dir.FullName))
+ // {
+ // System.IO.File.Delete(dir.FullName);
+ // tmpBool3 = true;
+ // }
+ // else if (System.IO.Directory.Exists(dir.FullName))
+ // {
+ // System.IO.Directory.Delete(dir.FullName);
+ // tmpBool3 = true;
+ // }
+ // else
+ // tmpBool3 = false;
+ // bool generatedAux = tmpBool3;
+ //}
+ }
public static void RmDir(System.String dir)
- {
- RmDir(new System.IO.DirectoryInfo(dir));
+ {
+ if(System.IO.Directory.Exists(dir))
+ System.IO.Directory.Delete(dir, true);
}
public static void SyncConcurrentMerges(IndexWriter writer)