Skip to content

Commit f07cff7

Browse files
committed
fix explorer setting UseLocationAsWorkingDir
1 parent 77977ee commit f07cff7

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ public static string GetPathWithActionKeyword(string path, ResultType type, stri
2727

2828
var usePathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled;
2929

30-
var pathSearchActionKeyword = Settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign
31-
? string.Empty
30+
var pathSearchActionKeyword = Settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign
31+
? string.Empty
3232
: $"{Settings.PathSearchActionKeyword} ";
3333

3434
var searchActionKeyword = Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
3535
? string.Empty
3636
: $"{Settings.SearchActionKeyword} ";
3737

3838
var keyword = usePathSearchActionKeyword ? pathSearchActionKeyword : searchActionKeyword;
39-
39+
4040
var formatted_path = path;
4141

4242
if (type == ResultType.Folder)
@@ -49,8 +49,8 @@ public static string GetPathWithActionKeyword(string path, ResultType type, stri
4949
public static string GetAutoCompleteText(string title, Query query, string path, ResultType resultType)
5050
{
5151
return !Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
52-
? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
53-
: GetPathWithActionKeyword(path, resultType, query.ActionKeyword);
52+
? $"{query.ActionKeyword} {title}" // Only Quick Access action keyword is used in this scenario
53+
: GetPathWithActionKeyword(path, resultType, query.ActionKeyword);
5454
}
5555

5656
public static Result CreateResult(Query query, SearchResult result)
@@ -215,9 +215,9 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK
215215

216216
internal static Result CreateFileResult(string filePath, Query query, int score = 0, bool windowsIndexed = false)
217217
{
218-
Result.PreviewInfo preview = IsMedia(Path.GetExtension(filePath)) ? new Result.PreviewInfo {
219-
IsMedia = true,
220-
PreviewImagePath = filePath,
218+
Result.PreviewInfo preview = IsMedia(Path.GetExtension(filePath)) ? new Result.PreviewInfo
219+
{
220+
IsMedia = true, PreviewImagePath = filePath,
221221
} : Result.PreviewInfo.Default;
222222

223223
var title = Path.GetFileName(filePath);
@@ -246,6 +246,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
246246
{
247247
FileName = filePath,
248248
UseShellExecute = true,
249+
WorkingDirectory = Settings.UseLocationAsWorkingDir ? Path.GetDirectoryName(filePath) : string.Empty,
249250
Verb = "runas",
250251
});
251252
}
@@ -286,16 +287,19 @@ internal static Result CreateFileResult(string filePath, Query query, int score
286287
public static bool IsMedia(string extension)
287288
{
288289
if (string.IsNullOrEmpty(extension))
289-
{
290-
return false;
290+
{
291+
return false;
291292
}
292293
else
293294
{
294295
return MediaExtensions.Contains(extension.ToLowerInvariant());
295296
}
296297
}
297298

298-
public static readonly string[] MediaExtensions = { ".jpg", ".png", ".avi", ".mkv", ".bmp", ".gif", ".wmv", ".mp3", ".flac", ".mp4" };
299+
public static readonly string[] MediaExtensions =
300+
{
301+
".jpg", ".png", ".avi", ".mkv", ".bmp", ".gif", ".wmv", ".mp3", ".flac", ".mp4"
302+
};
299303
}
300304

301305
public enum ResultType

0 commit comments

Comments
 (0)