mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
fix CreateOpenCurrentFolderResult incorrectly using foldername
This commit is contained in:
parent
f2690ebfe2
commit
cc3d7d7ded
2 changed files with 23 additions and 25 deletions
|
|
@ -45,44 +45,44 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
};
|
||||
}
|
||||
|
||||
internal static Result CreateOpenCurrentFolderResult(string path, bool isPreviousDirectoryLevel, bool windowsIndexed = false)
|
||||
internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIndexed = false)
|
||||
{
|
||||
var folderName = path;
|
||||
var folderName = "";
|
||||
|
||||
if (folderName.EndsWith(":\\"))
|
||||
var title = "Open current directory";
|
||||
|
||||
var previousDirectoryPath = FilesFolders.GetPreviousLevelDirectoryIfPathIncomplete(path);
|
||||
|
||||
if (previousDirectoryPath != path)
|
||||
{
|
||||
var driveLetter = folderName.Substring(0, 1).ToUpper();
|
||||
folderName = driveLetter + " drive";
|
||||
}
|
||||
else
|
||||
{
|
||||
folderName = folderName.TrimEnd(Constants.DirectorySeperator).Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
||||
if (previousDirectoryPath.EndsWith(":\\"))
|
||||
{
|
||||
var driveLetter = path.Substring(0, 1).ToUpper();
|
||||
folderName = driveLetter + " drive";
|
||||
}
|
||||
else
|
||||
{
|
||||
folderName = previousDirectoryPath.TrimEnd(Constants.DirectorySeperator).Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
||||
}
|
||||
|
||||
title = "Open " + folderName;
|
||||
}
|
||||
|
||||
var firstResult = "";
|
||||
|
||||
if (isPreviousDirectoryLevel)
|
||||
{
|
||||
firstResult = "Open " + folderName;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstResult = "Open current directory";
|
||||
}
|
||||
var fullPath = previousDirectoryPath != path ? previousDirectoryPath : path;
|
||||
|
||||
return new Result
|
||||
{
|
||||
Title = firstResult,
|
||||
Title = title,
|
||||
SubTitle = $"Use > to search files and subfolders within {folderName}, " +
|
||||
$"* to search for file extensions in {folderName} or both >* to combine the search",
|
||||
IcoPath = path,
|
||||
IcoPath = fullPath,
|
||||
Score = 500,
|
||||
Action = c =>
|
||||
{
|
||||
FilesFolders.OpenPath(path);
|
||||
return true;
|
||||
},
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = folderName, ShowIndexState = true, WindowsIndexed = windowsIndexed }
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = fullPath, ShowIndexState = true, WindowsIndexed = windowsIndexed }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,9 +55,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
var indexExists = _indexSearch.PathIsIndexed(locationPath);
|
||||
|
||||
results.Add(ResultManager.CreateOpenCurrentFolderResult(FilesFolders.GetPreviousLevelDirectoryIfPathIncomplete(locationPath),
|
||||
true,
|
||||
indexExists));
|
||||
results.Add(ResultManager.CreateOpenCurrentFolderResult(locationPath, indexExists));
|
||||
|
||||
results.AddRange(TopLevelFolderSearchBehaviour(WindowsIndexTopLevelFolderSearch,
|
||||
DirectoryInfoClassSearch,
|
||||
|
|
|
|||
Loading…
Reference in a new issue