[map] Fix non-stop file read exceptions in the Qt application #9894

Open
Ferenc- wants to merge 1 commit from fix-file-read-exception into master
3 changed files with 11 additions and 0 deletions

View file

@ -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();

View file

@ -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

View file

@ -40,6 +40,7 @@ public:
void Subscribe(Subscriber * subscriber);
void UnsubscribeAll();
void Init();
private:
struct Config