Use path of lnk to execute program

This commit is contained in:
Vic 2022-11-21 18:05:35 +08:00
parent a73c22f7f0
commit 1b51a461dc

View file

@ -37,7 +37,6 @@ namespace Flow.Launcher.Plugin.Program.Programs
/// Path of the actual executable file.
/// </summary>
public string ExecutablePath => LnkResolvedPath ?? FullPath;
public string WorkingDir => Directory.GetParent(ExecutablePath)?.FullName ?? string.Empty;
public string ParentDirectory { get; set; }
public string ExecutableName { get; set; }
public string Description { get; set; }
@ -140,8 +139,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
var info = new ProcessStartInfo
{
FileName = ExecutablePath,
WorkingDirectory = WorkingDir,
FileName = FullPath,
WorkingDirectory = ParentDirectory,
UseShellExecute = true,
Verb = runAsAdmin ? "runas" : null
};
@ -167,8 +166,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
var info = new ProcessStartInfo
{
FileName = ExecutablePath,
WorkingDirectory = WorkingDir,
FileName = FullPath,
WorkingDirectory = ParentDirectory,
UseShellExecute = true
};
@ -187,7 +186,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
var info = new ProcessStartInfo
{
FileName = ExecutablePath,
WorkingDirectory = WorkingDir,
WorkingDirectory = ParentDirectory,
Verb = "runas",
UseShellExecute = true
};
@ -573,6 +572,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
private static IEnumerable<Win32> ProgramsHasher(IEnumerable<Win32> programs)
{
// TODO: Unable to distinguish multiple lnks to the same excutable but with different params
return programs.GroupBy(p => p.ExecutablePath.ToLowerInvariant())
.AsParallel()
.SelectMany(g =>