Skip to content

Commit

Permalink
use actual path variable consistently throughout path search
Browse files Browse the repository at this point in the history
  • Loading branch information
jjw24 committed Jul 13, 2024
1 parent 67ae8e5 commit 4b78926
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo;
using Flow.Launcher.Plugin.Explorer.Search.Everything;
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
using Flow.Launcher.Plugin.SharedCommands;
Expand Down Expand Up @@ -180,16 +180,16 @@ private async Task<List<Result>> PathSearchAsync(Query query, CancellationToken

// Query is a location path with a full environment variable, eg. %appdata%\somefolder\, c:\users\%USERNAME%\downloads
var needToExpand = EnvironmentVariables.HasEnvironmentVar(querySearch);
var locationPath = needToExpand ? Environment.ExpandEnvironmentVariables(querySearch) : querySearch;
var path = needToExpand ? Environment.ExpandEnvironmentVariables(querySearch) : querySearch;

// Check that actual location exists, otherwise directory search will throw directory not found exception
if (!FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath).LocationExists())
if (!FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path).LocationExists())
return results.ToList();

var useIndexSearch = Settings.IndexSearchEngine is Settings.IndexSearchEngineOption.WindowsIndex
&& UseWindowsIndexForDirectorySearch(locationPath);
&& UseWindowsIndexForDirectorySearch(path);

var retrievedDirectoryPath = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath);
var retrievedDirectoryPath = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path);

results.Add(retrievedDirectoryPath.EndsWith(":\\")
? ResultManager.CreateDriveSpaceDisplayResult(retrievedDirectoryPath, query.ActionKeyword, useIndexSearch)
Expand All @@ -200,21 +200,21 @@ private async Task<List<Result>> PathSearchAsync(Query query, CancellationToken

IAsyncEnumerable<SearchResult> directoryResult;

var recursiveIndicatorIndex = query.Search.IndexOf('>');
var recursiveIndicatorIndex = path.IndexOf('>');

if (recursiveIndicatorIndex > 0 && Settings.PathEnumerationEngine != Settings.PathEnumerationEngineOption.DirectEnumeration)
{
directoryResult =
Settings.PathEnumerator.EnumerateAsync(
query.Search[..recursiveIndicatorIndex].Trim(),
query.Search[(recursiveIndicatorIndex + 1)..],
path[..recursiveIndicatorIndex].Trim(),
path[(recursiveIndicatorIndex + 1)..],
true,
token);

}
else
{
directoryResult = DirectoryInfoSearch.TopLevelDirectorySearch(query, query.Search, token).ToAsyncEnumerable();
directoryResult = DirectoryInfoSearch.TopLevelDirectorySearch(query, path, token).ToAsyncEnumerable();
}

if (token.IsCancellationRequested)
Expand Down

0 comments on commit 4b78926

Please sign in to comment.