@@ -16,36 +16,36 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
16
16
public class ProgramSource
17
17
{
18
18
private string name ;
19
+ private string loc = string . Empty ;
20
+ private string uniqueIdentifier = string . Empty ;
19
21
20
- private string loc ;
21
22
public string Location
22
23
{
23
24
get => loc ;
24
25
set
25
26
{
26
- loc = value ;
27
- UniqueIdentifier = value . ToLowerInvariant ( ) ;
27
+ loc = value ?? string . Empty ;
28
+ UniqueIdentifier = value ;
28
29
}
29
30
}
31
+
30
32
public string Name { get => name ?? new DirectoryInfo ( Location ) . Name ; set => name = value ; }
31
33
public bool Enabled { get ; set ; } = true ;
32
34
33
- public string UniqueIdentifier { get ; private set ; }
35
+ public string UniqueIdentifier { get => uniqueIdentifier ;
36
+ private set
37
+ {
38
+ uniqueIdentifier = value == null ? string . Empty : value . ToLowerInvariant ( ) ;
39
+ }
40
+ }
34
41
35
42
[ JsonConstructor ]
36
43
public ProgramSource ( string name , string location , bool enabled , string uniqueIdentifier )
37
44
{
38
- loc = location ;
45
+ loc = location ?? string . Empty ;
39
46
this . name = name ;
40
47
Enabled = enabled ;
41
- if ( location . Equals ( uniqueIdentifier , StringComparison . OrdinalIgnoreCase ) )
42
- {
43
- UniqueIdentifier = location . ToLowerInvariant ( ) ; // To make sure old config can be reset to case-insensitive
44
- }
45
- else
46
- {
47
- UniqueIdentifier = uniqueIdentifier ; // For uwp apps
48
- }
48
+ UniqueIdentifier = uniqueIdentifier ;
49
49
}
50
50
51
51
/// <summary>
@@ -55,9 +55,9 @@ public ProgramSource(string name, string location, bool enabled, string uniqueId
55
55
/// <param name="enabled">enabled</param>
56
56
public ProgramSource ( string location , bool enabled = true )
57
57
{
58
- loc = location ;
58
+ loc = location ?? string . Empty ;
59
59
Enabled = enabled ;
60
- UniqueIdentifier = location . ToLowerInvariant ( ) ; // For path comparison
60
+ UniqueIdentifier = location ; // For path comparison
61
61
}
62
62
63
63
public ProgramSource ( IProgram source )
0 commit comments