You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2011/07/07 00:41:54 UTC
[Lucene.Net] svn commit: r1143596 -
/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs
Author: mherndon
Date: Wed Jul 6 22:41:54 2011
New Revision: 1143596
URL: http://svn.apache.org/viewvc?rev=1143596&view=rev
Log:
LUCENENET-418 changing the logic under the ProjectRootDirectory property to dynamically calculate the root folder of the branch/trunk
Modified:
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs?rev=1143596&r1=1143595&r2=1143596&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs Wed Jul 6 22:41:54 2011
@@ -16,7 +16,9 @@
*/
using System;
-using System.IO;
+using System.IO;
+using System.Linq;
+using System.Collections.Generic;
namespace Lucene.Net.Util
{
@@ -123,8 +125,22 @@ namespace Lucene.Net.Util
{
// we currently assume that the assembly's directory is root/bin/[Section]/[Build]
// where [Section] is either core, demo, or contrib, and [Build] is either Debug or Release.
- var assemblyLocation = AssemblyDirectory;
- s_projectRootDirectory = CombinePath(assemblyLocation, "..", "..", "..");
+ string assemblyLocation = AssemblyDirectory;
+ int index = assemblyLocation.IndexOf(Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar);
+
+ int difference = assemblyLocation.Substring(index).Count(o => o == Path.DirectorySeparatorChar);
+
+ var list = new List<string>();
+
+ for (int i = 0; i < difference; i++)
+ list.Add("..");
+
+ var parameters = list.ToArray();
+
+ s_projectRootDirectory = Path.GetFullPath(CombinePath(assemblyLocation, parameters));
+
+ //TODO: remove
+ Console.WriteLine(s_projectRootDirectory);
}
return s_projectRootDirectory;
}