Skip to content

Commit 1b51a46

Browse files
Use path of lnk to execute program
1 parent a73c22f commit 1b51a46

File tree

1 file changed

+6
-6
lines changed
  • Plugins/Flow.Launcher.Plugin.Program/Programs

1 file changed

+6
-6
lines changed

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class Win32 : IProgram, IEquatable<Win32>
3737
/// Path of the actual executable file.
3838
/// </summary>
3939
public string ExecutablePath => LnkResolvedPath ?? FullPath;
40-
public string WorkingDir => Directory.GetParent(ExecutablePath)?.FullName ?? string.Empty;
4140
public string ParentDirectory { get; set; }
4241
public string ExecutableName { get; set; }
4342
public string Description { get; set; }
@@ -140,8 +139,8 @@ public Result Result(string query, IPublicAPI api)
140139

141140
var info = new ProcessStartInfo
142141
{
143-
FileName = ExecutablePath,
144-
WorkingDirectory = WorkingDir,
142+
FileName = FullPath,
143+
WorkingDirectory = ParentDirectory,
145144
UseShellExecute = true,
146145
Verb = runAsAdmin ? "runas" : null
147146
};
@@ -167,8 +166,8 @@ public List<Result> ContextMenus(IPublicAPI api)
167166
{
168167
var info = new ProcessStartInfo
169168
{
170-
FileName = ExecutablePath,
171-
WorkingDirectory = WorkingDir,
169+
FileName = FullPath,
170+
WorkingDirectory = ParentDirectory,
172171
UseShellExecute = true
173172
};
174173

@@ -187,7 +186,7 @@ public List<Result> ContextMenus(IPublicAPI api)
187186
var info = new ProcessStartInfo
188187
{
189188
FileName = ExecutablePath,
190-
WorkingDirectory = WorkingDir,
189+
WorkingDirectory = ParentDirectory,
191190
Verb = "runas",
192191
UseShellExecute = true
193192
};
@@ -573,6 +572,7 @@ public static IEnumerable<T> DistinctBy<T, R>(IEnumerable<T> source, Func<T, R>
573572

574573
private static IEnumerable<Win32> ProgramsHasher(IEnumerable<Win32> programs)
575574
{
575+
// TODO: Unable to distinguish multiple lnks to the same excutable but with different params
576576
return programs.GroupBy(p => p.ExecutablePath.ToLowerInvariant())
577577
.AsParallel()
578578
.SelectMany(g =>

0 commit comments

Comments
 (0)