diff --git a/map/framework.cpp b/map/framework.cpp index 734ea57059..a34ac7c1ab 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -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(); diff --git a/map/power_management/power_manager.cpp b/map/power_management/power_manager.cpp index fc3f33cd1f..353ae3a3bc 100644 --- a/map/power_management/power_manager.cpp +++ b/map/power_management/power_manager.cpp @@ -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 diff --git a/map/power_management/power_manager.hpp b/map/power_management/power_manager.hpp index 4d6935631e..c099679e9f 100644 --- a/map/power_management/power_manager.hpp +++ b/map/power_management/power_manager.hpp @@ -40,6 +40,7 @@ public: void Subscribe(Subscriber * subscriber); void UnsubscribeAll(); + void Init(); private: struct Config