Skip to content

Commit d2d1c47

Browse files
authored
Merge pull request #1620 from Flow-Launcher/fix_dup_results_explorer
[Dev] Fix duplicate Quick Access results from CreateOpenCurrentFolderResult
2 parents 184799a + 4862950 commit d2d1c47

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
5757
var icoPath = (record.Type == ResultType.File) ? Constants.FileImagePath : Constants.FolderImagePath;
5858
var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
5959

60-
if (Settings.QuickAccessLinks.All(x => x.Path != record.FullPath))
60+
if (Settings.QuickAccessLinks.All(x => !x.Path.Equals(record.FullPath, StringComparison.OrdinalIgnoreCase)))
6161
{
6262
contextMenus.Add(new Result
6363
{

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ private static string ToReadableSize(long pDrvSize, int pi)
167167

168168
internal static Result CreateOpenCurrentFolderResult(string path, string actionKeyword, bool windowsIndexed = false)
169169
{
170-
var folderName = path.TrimEnd(Constants.DirectorySeperator).Split(new[]
170+
// Path passed from PathSearchAsync ends with Constants.DirectorySeperator ('\'), need to remove the seperator
171+
// so it's consistent with folder results returned by index search which does not end with one
172+
var folderPath = path.TrimEnd(Constants.DirectorySeperator);
173+
174+
var folderName = folderPath.TrimEnd(Constants.DirectorySeperator).Split(new[]
171175
{
172176
Path.DirectorySeparatorChar
173177
}, StringSplitOptions.None).Last();
@@ -185,19 +189,19 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK
185189
Title = title,
186190
SubTitle = $"Use > to search within {subtitleFolderName}, " +
187191
$"* to search for file extensions or >* to combine both searches.",
188-
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
189-
IcoPath = path,
192+
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
193+
IcoPath = folderPath,
190194
Score = 500,
191-
CopyText = path,
195+
CopyText = folderPath,
192196
Action = _ =>
193197
{
194-
Context.API.OpenDirectory(path);
198+
Context.API.OpenDirectory(folderPath);
195199
return true;
196200
},
197201
ContextData = new SearchResult
198202
{
199203
Type = ResultType.Folder,
200-
FullPath = path,
204+
FullPath = folderPath,
201205
WindowsIndexed = windowsIndexed
202206
}
203207
};

0 commit comments

Comments
 (0)