mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
Add isCorrectlyApplied()
This commit is contained in:
@@ -99,5 +99,31 @@ namespace EnvironmentVariables.Models
|
||||
viewModel.ApplyingChanges = false;
|
||||
});
|
||||
}
|
||||
|
||||
public bool IsCorrectlyApplied()
|
||||
{
|
||||
if (!IsEnabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var variable in Variables)
|
||||
{
|
||||
var applied = EnvironmentVariablesHelper.GetExisting(variable.Name);
|
||||
if (applied != null && applied.Values == variable.Values && applied.ParentType == VariablesSetType.User)
|
||||
{
|
||||
var backupName = EnvironmentVariablesHelper.GetBackupVariableName(variable, Name);
|
||||
var backup = EnvironmentVariablesHelper.GetExisting(backupName);
|
||||
if (backup != null && backup.ParentType == VariablesSetType.User)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user