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
3 changes: 2 additions & 1 deletion Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ public override int GetHashCode()
[Serializable]
public class Application : IProgram
{
public string UniqueIdentifier { get; set; }
private string _uid = string.Empty;
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); }
public string DisplayName { get; set; }
public string Description { get; set; }
public string UserModelId { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
public class Win32 : IProgram, IEquatable<Win32>
{
public string Name { get; set; }
public string UniqueIdentifier { get => _uid; set => _uid = value.ToLowerInvariant(); } // For path comparison
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); } // For path comparison
public string IcoPath { get; set; }
public string FullPath { get; set; }
public string LnkResolvedPath { get; set; }
Expand Down
41 changes: 22 additions & 19 deletions Plugins/Flow.Launcher.Plugin.Program/Views/Models/ProgramSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,39 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
/// </remarks>
public class ProgramSource
{
private string name;
private string name = string.Empty;
private string loc = string.Empty;
private string uniqueIdentifier = string.Empty;

private string loc;
public string Location
{
get => loc;
set
{
loc = value;
UniqueIdentifier = value.ToLowerInvariant();
loc = value ?? string.Empty;
UniqueIdentifier = value;
}
}
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }

public string Name { get => name; set => name = value ?? string.Empty; }
public bool Enabled { get; set; } = true;

public string UniqueIdentifier { get; private set; }
public string UniqueIdentifier
{
get => uniqueIdentifier;
private set
{
uniqueIdentifier = value == null ? string.Empty : value.ToLowerInvariant();
}
}

[JsonConstructor]
public ProgramSource(string name, string location, bool enabled, string uniqueIdentifier)
{
loc = location;
this.name = name;
loc = location ?? string.Empty;
Name = name;
Enabled = enabled;
if (location.Equals(uniqueIdentifier, StringComparison.OrdinalIgnoreCase))
{
UniqueIdentifier = location.ToLowerInvariant(); // To make sure old config can be reset to case-insensitive
}
else
{
UniqueIdentifier = uniqueIdentifier; // For uwp apps
}
UniqueIdentifier = uniqueIdentifier;
}

/// <summary>
Expand All @@ -55,14 +57,15 @@ public ProgramSource(string name, string location, bool enabled, string uniqueId
/// <param name="enabled">enabled</param>
public ProgramSource(string location, bool enabled = true)
{
loc = location;
loc = location ?? string.Empty;
Enabled = enabled;
UniqueIdentifier = location.ToLowerInvariant(); // For path comparison
UniqueIdentifier = location; // For path comparison
Name = new DirectoryInfo(Location).Name;
}

public ProgramSource(IProgram source)
{
loc = source.Location;
loc = source.Location ?? string.Empty;
Name = source.Name;
Enabled = source.Enabled;
UniqueIdentifier = source.UniqueIdentifier;
Expand Down