[map] Fix non-stop file read exceptions in the Qt application #9894
3 changed files with 11 additions and 0 deletions
|
@ -373,6 +373,7 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps)
|
|||
InitTransliteration();
|
||||
LOG(LDEBUG, ("Transliterators initialized"));
|
||||
|
||||
GetPowerManager().Init();
|
||||
/// @todo No any real config loading here for now.
|
||||
GetPowerManager().Subscribe(this);
|
||||
GetPowerManager().Load();
|
||||
|
|
|
@ -225,4 +225,13 @@ bool PowerManager::Save()
|
|||
Load();
|
||||
return false;
|
||||
}
|
||||
|
||||
void PowerManager::Init()
|
||||
{
|
||||
FILE* fp = std::fopen(GetConfigPath().c_str(), "r");
|
||||
if (fp)
|
||||
std::fclose(fp);
|
||||
else
|
||||
Save();
|
||||
}
|
||||
} // namespace power_management
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
void Subscribe(Subscriber * subscriber);
|
||||
void UnsubscribeAll();
|
||||
void Init();
|
||||
|
||||
private:
|
||||
struct Config
|
||||
|
|
Reference in a new issue