whitespace

This commit is contained in:
TheBestPessimist 2023-01-30 14:44:48 +02:00
parent 51c909800f
commit 9e11b0cd9d

View file

@ -25,23 +25,29 @@ namespace Flow.Launcher.Plugin.Program.Programs
public string Name { get; set; }
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 and .url for .lnk and .url files.
/// </summary>
public string FullPath { get; set; }
/// <summary>
/// Path of the executable for .lnk, or the URL for .url. Arguments are included if any.
/// </summary>
public string LnkResolvedPath { get; set; }
/// <summary>
/// Path of the actual executable file. Args are included.
/// </summary>
public string ExecutablePath => LnkResolvedPath ?? FullPath;
public string ParentDirectory { get; set; }
/// <summary>
/// Name of the executable for .lnk files
/// </summary>
public string ExecutableName { get; set; }
public string Description { get; set; }
public bool Valid { get; set; }
public bool Enabled { get; set; }
@ -199,9 +205,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
var info = new ProcessStartInfo
{
FileName = FullPath,
WorkingDirectory = ParentDirectory,
UseShellExecute = true
FileName = FullPath, WorkingDirectory = ParentDirectory, UseShellExecute = true
};
Task.Run(() => Main.StartProcess(ShellCommand.RunAsDifferentUser, info));
@ -363,6 +367,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
return program;
}
foreach (var protocol in protocols)
{
if (url.StartsWith(protocol))
@ -418,10 +423,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
if (!Directory.Exists(directory))
return Enumerable.Empty<string>();
return Directory.EnumerateFiles(directory, "*", new EnumerationOptions
{
IgnoreInaccessible = true, RecurseSubdirectories = recursive
}).Where(x => suffixes.Contains(Extension(x)));
return Directory
.EnumerateFiles(
directory,
"*",
new EnumerationOptions { IgnoreInaccessible = true, RecurseSubdirectories = recursive })
.Where(x => suffixes.Contains(Extension(x)));
}
private static string Extension(string path)
@ -471,7 +478,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
}
var paths = pathEnv.Split(";", StringSplitOptions.RemoveEmptyEntries).DistinctBy(p => p.ToLowerInvariant());
var toFilter = paths.Where(x => commonParents.All(parent => !FilesFolders.PathContains(parent, x)))
.AsParallel()
.SelectMany(p => EnumerateProgramsInDir(p, suffixes, recursive: false));