[FileLocksmith][PowerRename]Fix regression by reloading module settings (#32192)

This commit is contained in:
Stefan Markovic 2024-04-02 22:18:41 +02:00 committed by GitHub
parent b31eaf3a0b
commit 7b89482b94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 0 deletions

View File

@ -15,6 +15,7 @@ public:
return true;
if (gpoSetting == powertoys_gpo::gpo_rule_configured_disabled)
return false;
Reload();
RefreshEnabledState();
return settings.enabled;
}

View File

@ -72,6 +72,17 @@ void CSettings::Load()
}
}
void CSettings::Reload()
{
// Load json settings from data file if it is modified in the meantime.
FILETIME lastModifiedTime{};
if (LastModifiedTime(moduleJsonFilePath, &lastModifiedTime) &&
CompareFileTime(&lastModifiedTime, &lastLoadedTime) == 1)
{
Load();
}
}
void CSettings::RefreshEnabledState()
{
// Load json settings from data file if it is modified in the meantime.

View File

@ -15,6 +15,7 @@ public:
return true;
if (gpoSetting == powertoys_gpo::gpo_rule_configured_disabled)
return false;
Reload();
RefreshEnabledState();
return settings.enabled;
}
@ -106,6 +107,7 @@ private:
unsigned int flags{ 0 };
};
void Reload();
void RefreshEnabledState();
void MigrateFromRegistry();
void ParseJson();