lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhern...@apache.org
Subject [Lucene.Net] svn commit: r1143596 - /incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Util/Paths.cs
Date Wed, 06 Jul 2011 22:41:54 GMT
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;
             }



Mime
View raw message