mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix location setter and uid case
This commit is contained in:
parent
3efa0e185d
commit
cc7d2bc855
3 changed files with 25 additions and 24 deletions
|
|
@ -63,7 +63,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
}
|
||||
if (!update)
|
||||
{
|
||||
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(path, System.StringComparison.InvariantCultureIgnoreCase)))
|
||||
if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(path, System.StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var source = new ProgramSource(path);
|
||||
modified = true;
|
||||
|
|
@ -76,7 +76,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
modified = _editing.Location != path || _editing.Enabled != Chkbox.IsChecked;
|
||||
if (modified)
|
||||
{
|
||||
_editing.SetLocation(path);
|
||||
_editing.Location = path;
|
||||
_editing.Enabled = Chkbox.IsChecked ?? true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,16 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
|
|||
{
|
||||
private string name;
|
||||
|
||||
public string Location { get; private set; }
|
||||
private string loc;
|
||||
public string Location
|
||||
{
|
||||
get => loc;
|
||||
set
|
||||
{
|
||||
loc = value;
|
||||
UniqueIdentifier = value.ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
|
|
@ -27,10 +36,17 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
|
|||
[JsonConstructor]
|
||||
public ProgramSource(string name, string location, bool enabled, string uniqueIdentifier)
|
||||
{
|
||||
Location = location;
|
||||
loc = location;
|
||||
this.name = name;
|
||||
Enabled = enabled;
|
||||
UniqueIdentifier = uniqueIdentifier;
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -38,24 +54,16 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
|
|||
/// </summary>
|
||||
/// <param name="location">location of program source</param>
|
||||
/// <param name="enabled">enabled</param>
|
||||
public ProgramSource(string location, bool enabled=true)
|
||||
public ProgramSource(string location, bool enabled = true)
|
||||
{
|
||||
Location = location;
|
||||
loc = location;
|
||||
Enabled = enabled;
|
||||
UniqueIdentifier = location.ToLowerInvariant(); // For path comparison
|
||||
}
|
||||
|
||||
public ProgramSource(ProgramSource source)
|
||||
{
|
||||
Location = source.Location;
|
||||
Name = source.Name;
|
||||
Enabled = source.Enabled;
|
||||
UniqueIdentifier = source.UniqueIdentifier;
|
||||
}
|
||||
|
||||
public ProgramSource(IProgram source)
|
||||
{
|
||||
Location = source.Location;
|
||||
loc = source.Location;
|
||||
Name = source.Name;
|
||||
Enabled = source.Enabled;
|
||||
UniqueIdentifier = source.UniqueIdentifier;
|
||||
|
|
@ -75,12 +83,5 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
|
|||
{
|
||||
return HashCode.Combine(UniqueIdentifier);
|
||||
}
|
||||
|
||||
public void SetLocation(string value)
|
||||
{
|
||||
if (Location == value) return;
|
||||
Location = value;
|
||||
UniqueIdentifier = value.ToLowerInvariant(); // Update
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ namespace Flow.Launcher.Plugin.Program.Views
|
|||
foreach (string directory in directories)
|
||||
{
|
||||
if (Directory.Exists(directory)
|
||||
&& !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(directory, System.StringComparison.InvariantCultureIgnoreCase)))
|
||||
&& !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(directory, System.StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
var source = new ProgramSource(directory);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue