Skip to content

Commit 3b8e786

Browse files
committed
fix duplicate Quick Access results from CreateOpenCurrentFolderResult
1 parent ef04819 commit 3b8e786

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
@@ -168,7 +168,11 @@ private static string ToReadableSize(long pDrvSize, int pi)
168168

169169
internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIndexed = false)
170170
{
171-
var folderName = path.TrimEnd(Constants.DirectorySeperator).Split(new[]
171+
// Path passed from PathSearchAsync ends with Constants.DirectorySeperator ('\'), need to remove the seperator
172+
// so it's consistent with folder results returned by index search which does not end with one
173+
var folderPath = path.TrimEnd(Constants.DirectorySeperator);
174+
175+
var folderName = folderPath.TrimEnd(Constants.DirectorySeperator).Split(new[]
172176
{
173177
Path.DirectorySeparatorChar
174178
}, StringSplitOptions.None).Last();
@@ -186,19 +190,19 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn
186190
Title = title,
187191
SubTitle = $"Use > to search within {subtitleFolderName}, " +
188192
$"* to search for file extensions or >* to combine both searches.",
189-
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder),
190-
IcoPath = path,
193+
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder),
194+
IcoPath = folderPath,
191195
Score = 500,
192-
CopyText = path,
196+
CopyText = folderPath,
193197
Action = _ =>
194198
{
195-
Context.API.OpenDirectory(path);
199+
Context.API.OpenDirectory(folderPath);
196200
return true;
197201
},
198202
ContextData = new SearchResult
199203
{
200204
Type = ResultType.Folder,
201-
FullPath = path,
205+
FullPath = folderPath,
202206
WindowsIndexed = windowsIndexed
203207
}
204208
};

0 commit comments

Comments
 (0)