diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs index dd4dcc7a4..4137ca8d0 100644 --- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs +++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs @@ -263,7 +263,7 @@ namespace Flow.Launcher.Plugin.SharedCommands } /// - /// Returns if contains . + /// Returns if contains . Equal paths are not considered to be contained by default. /// From https://stackoverflow.com/a/66877016 /// /// Parent path diff --git a/Flow.Launcher.Test/FilesFoldersTest.cs b/Flow.Launcher.Test/FilesFoldersTest.cs index d16826053..3dead9918 100644 --- a/Flow.Launcher.Test/FilesFoldersTest.cs +++ b/Flow.Launcher.Test/FilesFoldersTest.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Plugin.SharedCommands; +using Flow.Launcher.Plugin.SharedCommands; using NUnit.Framework; namespace Flow.Launcher.Test @@ -33,21 +33,21 @@ namespace Flow.Launcher.Test [TestCase(@"c:\foo", @"c:\foo\..\bar\baz", false)] [TestCase(@"c:\bar", @"c:\foo\..\bar\baz", true)] [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) { 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)] - 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)); } } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index f58ac43e8..5fe01d3a5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -123,7 +123,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search } 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(); }