mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2332 from VictoriousRaptor/fix-exclude-path-check
Fix exclude path check for index search
This commit is contained in:
commit
ef84b2b597
3 changed files with 9 additions and 9 deletions
|
|
@ -263,7 +263,7 @@ namespace Flow.Launcher.Plugin.SharedCommands
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns if <paramref name="parentPath"/> contains <paramref name="subPath"/>.
|
/// Returns if <paramref name="parentPath"/> contains <paramref name="subPath"/>. Equal paths are not considered to be contained by default.
|
||||||
/// From https://stackoverflow.com/a/66877016
|
/// From https://stackoverflow.com/a/66877016
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parentPath">Parent path</param>
|
/// <param name="parentPath">Parent path</param>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Flow.Launcher.Plugin.SharedCommands;
|
using Flow.Launcher.Plugin.SharedCommands;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Flow.Launcher.Test
|
namespace Flow.Launcher.Test
|
||||||
|
|
@ -33,21 +33,21 @@ namespace Flow.Launcher.Test
|
||||||
[TestCase(@"c:\foo", @"c:\foo\..\bar\baz", false)]
|
[TestCase(@"c:\foo", @"c:\foo\..\bar\baz", false)]
|
||||||
[TestCase(@"c:\bar", @"c:\foo\..\bar\baz", true)]
|
[TestCase(@"c:\bar", @"c:\foo\..\bar\baz", true)]
|
||||||
[TestCase(@"c:\barr", @"c:\foo\..\bar\baz", false)]
|
[TestCase(@"c:\barr", @"c:\foo\..\bar\baz", false)]
|
||||||
// Equality
|
|
||||||
[TestCase(@"c:\foo", @"c:\foo", false)]
|
|
||||||
[TestCase(@"c:\foo\", @"c:\foo", false)]
|
|
||||||
[TestCase(@"c:\foo", @"c:\foo\", false)]
|
|
||||||
public void GivenTwoPaths_WhenCheckPathContains_ThenShouldBeExpectedResult(string parentPath, string path, bool expectedResult)
|
public void GivenTwoPaths_WhenCheckPathContains_ThenShouldBeExpectedResult(string parentPath, string path, bool expectedResult)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(expectedResult, FilesFolders.PathContains(parentPath, path));
|
Assert.AreEqual(expectedResult, FilesFolders.PathContains(parentPath, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Equality
|
||||||
|
[TestCase(@"c:\foo", @"c:\foo", false)]
|
||||||
|
[TestCase(@"c:\foo\", @"c:\foo", false)]
|
||||||
|
[TestCase(@"c:\foo", @"c:\foo\", false)]
|
||||||
[TestCase(@"c:\foo", @"c:\foo", true)]
|
[TestCase(@"c:\foo", @"c:\foo", true)]
|
||||||
[TestCase(@"c:\foo\", @"c:\foo", true)]
|
[TestCase(@"c:\foo\", @"c:\foo", true)]
|
||||||
[TestCase(@"c:\foo", @"c:\foo\", true)]
|
[TestCase(@"c:\foo", @"c:\foo\", true)]
|
||||||
public void GivenTwoPathsAreTheSame_WhenCheckPathContains_ThenShouldBeTrue(string parentPath, string path, bool expectedResult)
|
public void GivenTwoPathsAreTheSame_WhenCheckPathContains_ThenShouldBeExpectedResult(string parentPath, string path, bool expectedResult)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(expectedResult, FilesFolders.PathContains(parentPath, path, true));
|
Assert.AreEqual(expectedResult, FilesFolders.PathContains(parentPath, path, allowEqual: expectedResult));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
||||||
}
|
}
|
||||||
|
|
||||||
results.RemoveWhere(r => Settings.IndexSearchExcludedSubdirectoryPaths.Any(
|
results.RemoveWhere(r => Settings.IndexSearchExcludedSubdirectoryPaths.Any(
|
||||||
excludedPath => FilesFolders.PathContains(excludedPath.Path, r.SubTitle)));
|
excludedPath => FilesFolders.PathContains(excludedPath.Path, r.SubTitle, allowEqual: true)));
|
||||||
|
|
||||||
return results.ToList();
|
return results.ToList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue