Skip to content

Commit 2b14d5b

Browse files
Distinguish .lnks by arguments
1 parent 626e8b1 commit 2b14d5b

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public class ShellLink
9797
}
9898

9999
// To initialize the app description
100-
public String description = String.Empty;
101-
100+
public string description = string.Empty;
101+
public string arguments = string.Empty;
102102

103103
// Retrieve the target path using Shell Link
104104
public string retrieveTargetPath(string path)
@@ -122,13 +122,16 @@ public string retrieveTargetPath(string path)
122122
buffer = new StringBuilder(MAX_PATH);
123123
((IShellLinkW)link).GetDescription(buffer, MAX_PATH);
124124
description = buffer.ToString();
125+
126+
buffer.Clear();
127+
((IShellLinkW)link).GetArguments(buffer, MAX_PATH);
128+
arguments = buffer.ToString();
125129
}
126130

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

130134
return target;
131-
132135
}
133136
}
134-
}
137+
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public class Win32 : IProgram, IEquatable<Win32>
2626
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); } // For path comparison
2727
public string IcoPath { get; set; }
2828
/// <summary>
29-
/// Path of the file. It's the path of .lnk or .url for .lnk and .url.
29+
/// Path of the file. It's the path of .lnk and .url for .lnk and .url files.
3030
/// </summary>
3131
public string FullPath { get; set; }
3232
/// <summary>
33-
/// Path of the excutable for .lnk, or the URL for .url.
33+
/// Path of the excutable for .lnk, or the URL for .url. Arguments are included if any.
3434
/// </summary>
3535
public string LnkResolvedPath { get; set; }
3636
/// <summary>
@@ -185,7 +185,7 @@ public List<Result> ContextMenus(IPublicAPI api)
185185
{
186186
var info = new ProcessStartInfo
187187
{
188-
FileName = ExecutablePath,
188+
FileName = FullPath,
189189
WorkingDirectory = ParentDirectory,
190190
Verb = "runas",
191191
UseShellExecute = true
@@ -275,6 +275,12 @@ private static Win32 LnkProgram(string path)
275275
program.LnkResolvedPath = Path.GetFullPath(target);
276276
program.ExecutableName = Path.GetFileName(target);
277277

278+
var args = _helper.arguments;
279+
if(!string.IsNullOrEmpty(args))
280+
{
281+
program.LnkResolvedPath += " " + args;
282+
}
283+
278284
var description = _helper.description;
279285
if (!string.IsNullOrEmpty(description))
280286
{

0 commit comments

Comments
 (0)