Merge pull request #1563 from VictoriousRaptor/ProgramIndexPATH

Distinguish .lnks by arguments
This commit is contained in:
VictoriousRaptor 2022-11-23 04:12:53 +08:00 committed by GitHub
commit ced7fb02a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -97,8 +97,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
}
// 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)
@ -122,13 +122,16 @@ namespace Flow.Launcher.Plugin.Program.Programs
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;
}
}
}
}

View file

@ -26,11 +26,11 @@ namespace Flow.Launcher.Plugin.Program.Programs
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>
@ -185,7 +185,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
var info = new ProcessStartInfo
{
FileName = ExecutablePath,
FileName = FullPath,
WorkingDirectory = ParentDirectory,
Verb = "runas",
UseShellExecute = true
@ -275,6 +275,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
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))
{