Skip to content

Commit 400caa6

Browse files
authored
merge PR #141
plugin/explorer: fix navigation to localized path
2 parents c6bee8a + 027fa21 commit 400caa6

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

Flow.Launcher.Test/Plugins/ExplorerTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public void GivenWindowsIndexSearch_WhenProvidedFolderPath_ThenQueryWhereRestric
5858
$"Actual: {result}{Environment.NewLine}");
5959
}
6060

61-
[TestCase("C:\\", "SELECT TOP 100 System.FileName, System.ItemPathDisplay, System.ItemType FROM SystemIndex WHERE directory='file:C:\\'")]
62-
[TestCase("C:\\SomeFolder\\", "SELECT TOP 100 System.FileName, System.ItemPathDisplay, System.ItemType FROM SystemIndex WHERE directory='file:C:\\SomeFolder\\'")]
61+
[TestCase("C:\\", "SELECT TOP 100 System.FileName, System.ItemUrl, System.ItemType FROM SystemIndex WHERE directory='file:C:\\'")]
62+
[TestCase("C:\\SomeFolder\\", "SELECT TOP 100 System.FileName, System.ItemUrl, System.ItemType FROM SystemIndex WHERE directory='file:C:\\SomeFolder\\'")]
6363
public void GivenWindowsIndexSearch_WhenSearchTypeIsTopLevelDirectorySearch_ThenQueryShouldUseExpectedString(string folderPath, string expectedString)
6464
{
6565
// Given
@@ -74,7 +74,7 @@ public void GivenWindowsIndexSearch_WhenSearchTypeIsTopLevelDirectorySearch_Then
7474
$"Actual string was: {queryString}{Environment.NewLine}");
7575
}
7676

77-
[TestCase("C:\\SomeFolder\\flow.launcher.sln", "SELECT TOP 100 System.FileName, System.ItemPathDisplay, System.ItemType " +
77+
[TestCase("C:\\SomeFolder\\flow.launcher.sln", "SELECT TOP 100 System.FileName, System.ItemUrl, System.ItemType " +
7878
"FROM SystemIndex WHERE (System.FileName LIKE 'flow.launcher.sln%' " +
7979
"OR CONTAINS(System.FileName,'\"flow.launcher.sln*\"',1033))" +
8080
" AND directory='file:C:\\SomeFolder'")]
@@ -126,7 +126,7 @@ public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryWhereR
126126
$"Actual string was: {resultString}{Environment.NewLine}");
127127
}
128128

129-
[TestCase("flow.launcher.sln", "SELECT TOP 100 \"System.FileName\", \"System.ItemPathDisplay\", \"System.ItemType\" " +
129+
[TestCase("flow.launcher.sln", "SELECT TOP 100 \"System.FileName\", \"System.ItemUrl\", \"System.ItemType\" " +
130130
"FROM \"SystemIndex\" WHERE (System.FileName LIKE 'flow.launcher.sln%' " +
131131
"OR CONTAINS(System.FileName,'\"flow.launcher.sln*\"',1033)) AND scope='file:'")]
132132
public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryShouldUseExpectedString(
@@ -200,7 +200,7 @@ public void GivenWindowsIndexSearch_WhenQueryWhereRestrictionsIsForFileContentSe
200200
$"Actual string was: {resultString}{Environment.NewLine}");
201201
}
202202

203-
[TestCase("some words", "SELECT TOP 100 System.FileName, System.ItemPathDisplay, System.ItemType " +
203+
[TestCase("some words", "SELECT TOP 100 System.FileName, System.ItemUrl, System.ItemType " +
204204
"FROM SystemIndex WHERE FREETEXT('some words') AND scope='file:'")]
205205
public void GivenWindowsIndexSearch_WhenSearchForFileContent_ThenQueryShouldUseExpectedString(
206206
string userSearchString, string expectedString)

Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ internal List<Result> ExecuteWindowsIndexSearch(string indexQueryString, string
5151
{
5252
if (dataReaderResults.GetValue(0) != DBNull.Value && dataReaderResults.GetValue(1) != DBNull.Value)
5353
{
54+
var path = new Uri(dataReaderResults.GetString(1)).LocalPath;
55+
5456
if (dataReaderResults.GetString(2) == "Directory")
5557
{
5658
folderResults.Add(resultManager.CreateFolderResult(
5759
dataReaderResults.GetString(0),
58-
dataReaderResults.GetString(1),
59-
dataReaderResults.GetString(1),
60+
path,
61+
path,
6062
query, true, true));
6163
}
6264
else
6365
{
64-
fileResults.Add(resultManager.CreateFileResult(dataReaderResults.GetString(1), query, true, true));
66+
fileResults.Add(resultManager.CreateFileResult(path, query, true, true));
6567
}
6668
}
6769
}

Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public CSearchQueryHelper CreateBaseQuery()
2121
baseQuery.QueryMaxResults = settings.MaxResult;
2222

2323
// Set list of columns we want to display, getting the path presently
24-
baseQuery.QuerySelectColumns = "System.FileName, System.ItemPathDisplay, System.ItemType";
24+
baseQuery.QuerySelectColumns = "System.FileName, System.ItemUrl, System.ItemType";
2525

2626
// Filter based on file name
2727
baseQuery.QueryContentProperties = "System.FileName";

Plugins/Flow.Launcher.Plugin.Explorer/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Name": "Explorer",
88
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",
99
"Author": "Jeremy Wu",
10-
"Version": "1.2.0",
10+
"Version": "1.2.1",
1111
"Language": "csharp",
1212
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1313
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",

0 commit comments

Comments
 (0)