Skip to content

Commit 135f63a

Browse files
authored
Merge pull request #146 from Flow-Launcher/dev
Release 1.2.1
2 parents a8bfe6e + 104a00e commit 135f63a

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
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/EnvironmentVariables.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ internal static Dictionary<string, string> LoadEnvironmentStringPaths()
2222

2323
foreach (DictionaryEntry special in Environment.GetEnvironmentVariables())
2424
{
25-
if (Directory.Exists(special.Value.ToString()))
25+
var path = special.Value.ToString();
26+
if (Directory.Exists(path))
2627
{
28+
// we add a trailing slash to the path to make sure drive paths become valid absolute paths.
29+
// for example, if %systemdrive% is C: we turn it to C:\
30+
path = path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;
31+
32+
// if we don't have an absolute path, we use Path.GetFullPath to get one.
33+
// for example, if %homepath% is \Users\John we turn it to C:\Users\John
34+
path = Path.IsPathFullyQualified(path) ? path : Path.GetFullPath(path);
35+
2736
// Variables are returned with a mixture of all upper/lower case.
2837
// Call ToLower() to make the results look consistent
29-
envStringPaths.Add(special.Key.ToString().ToLower(), special.Value.ToString());
38+
envStringPaths.Add(special.Key.ToString().ToLower(), path);
3039
}
3140
}
3241

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.2",
1111
"Language": "csharp",
1212
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1313
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",

SolutionAssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
[assembly: AssemblyTrademark("")]
1717
[assembly: AssemblyCulture("")]
1818
[assembly: ComVisible(false)]
19-
[assembly: AssemblyVersion("1.2.0")]
20-
[assembly: AssemblyFileVersion("1.2.0")]
21-
[assembly: AssemblyInformationalVersion("1.2.0")]
19+
[assembly: AssemblyVersion("1.2.1")]
20+
[assembly: AssemblyFileVersion("1.2.1")]
21+
[assembly: AssemblyInformationalVersion("1.2.1")]

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '1.2.0.{build}'
1+
version: '1.2.1.{build}'
22

33
init:
44
- ps: |

0 commit comments

Comments
 (0)