Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Plugins/Flow.Launcher.Plugin.Program/Programs/ShellLinkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public class ShellLink
}

// To initialize the app description
public String description = String.Empty;

public string description = string.Empty;
public string arguments = string.Empty;

// Retrieve the target path using Shell Link
public string retrieveTargetPath(string path)
Expand All @@ -122,13 +122,16 @@ public string retrieveTargetPath(string path)
buffer = new StringBuilder(MAX_PATH);
((IShellLinkW)link).GetDescription(buffer, MAX_PATH);
description = buffer.ToString();

buffer.Clear();
((IShellLinkW)link).GetArguments(buffer, MAX_PATH);
arguments = buffer.ToString();
}

// To release unmanaged memory
Marshal.ReleaseComObject(link);

return target;

}
}
}
}
12 changes: 9 additions & 3 deletions Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public class Win32 : IProgram, IEquatable<Win32>
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); } // For path comparison
public string IcoPath { get; set; }
/// <summary>
/// Path of the file. It's the path of .lnk or .url for .lnk and .url.
/// Path of the file. It's the path of .lnk and .url for .lnk and .url files.
/// </summary>
public string FullPath { get; set; }
/// <summary>
/// Path of the excutable for .lnk, or the URL for .url.
/// Path of the excutable for .lnk, or the URL for .url. Arguments are included if any.
/// </summary>
public string LnkResolvedPath { get; set; }
/// <summary>
Expand Down Expand Up @@ -185,7 +185,7 @@ public List<Result> ContextMenus(IPublicAPI api)
{
var info = new ProcessStartInfo
{
FileName = ExecutablePath,
FileName = FullPath,
WorkingDirectory = ParentDirectory,
Verb = "runas",
UseShellExecute = true
Expand Down Expand Up @@ -275,6 +275,12 @@ private static Win32 LnkProgram(string path)
program.LnkResolvedPath = Path.GetFullPath(target);
program.ExecutableName = Path.GetFileName(target);

var args = _helper.arguments;
if(!string.IsNullOrEmpty(args))
{
program.LnkResolvedPath += " " + args;
}

var description = _helper.description;
if (!string.IsNullOrEmpty(description))
{
Expand Down