You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2014/12/30 23:39:00 UTC
lucenenet git commit: fix path lookup
Repository: lucenenet
Updated Branches:
refs/heads/master 2bf20847f -> aa1f8b4f0
fix path lookup
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/aa1f8b4f
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/aa1f8b4f
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/aa1f8b4f
Branch: refs/heads/master
Commit: aa1f8b4f0e14949cb27556a4617329a5d32dbdcd
Parents: 2bf2084
Author: Laimonas Simutis <la...@gmail.com>
Authored: Tue Dec 30 17:08:08 2014 -0500
Committer: Laimonas Simutis <la...@gmail.com>
Committed: Tue Dec 30 17:08:08 2014 -0500
----------------------------------------------------------------------
src/Lucene.Net.TestFramework/Util/Paths.cs | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/aa1f8b4f/src/Lucene.Net.TestFramework/Util/Paths.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/Paths.cs b/src/Lucene.Net.TestFramework/Util/Paths.cs
index 2685305..e0e30fc 100644
--- a/src/Lucene.Net.TestFramework/Util/Paths.cs
+++ b/src/Lucene.Net.TestFramework/Util/Paths.cs
@@ -137,32 +137,27 @@ 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.
- string assemblyLocation = AssemblyDirectory;
- int index = -1;
+ var assemblyLocation = AssemblyDirectory;
- var buildPathPart = Path.DirectorySeparatorChar + "build" + Path.DirectorySeparatorChar;
- var binPathPart = Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar;
-
- if (assemblyLocation.IndexOf("build", StringComparison.InvariantCultureIgnoreCase) > -1)
- {
- index = assemblyLocation.IndexOf(buildPathPart, StringComparison.InvariantCultureIgnoreCase);
- }
- else
+ var index = assemblyLocation.IndexOf(Path.DirectorySeparatorChar + "build" + Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase);
+ if (index == -1)
{
- index = assemblyLocation.IndexOf(binPathPart, StringComparison.InvariantCultureIgnoreCase);
+ index = assemblyLocation.IndexOf(Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase);
}
if (index < 0)
{
- throw new ArgumentOutOfRangeException("Could not locate project root directory in " + assemblyLocation + ", checked " + buildPathPart + " and " + binPathPart);
+ throw new ArgumentOutOfRangeException("Could not locate project root directory in " + assemblyLocation);
}
- int difference = assemblyLocation.Substring(index).Count(o => o == Path.DirectorySeparatorChar);
+ var 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();