Add profile and savegame fetchers in SystemUtils
This breaks the tests compilation. :/dev-ui
parent
df5edc703c
commit
991dbd1e37
|
@ -187,3 +187,13 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CSystemUtils::profileFileLocation()
|
||||||
|
{
|
||||||
|
return std::string("colobot.ini");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CSystemUtils::savegameDirectoryLocation()
|
||||||
|
{
|
||||||
|
return std::string("savegame");
|
||||||
|
}
|
||||||
|
|
|
@ -129,6 +129,12 @@ public:
|
||||||
//! Returns the exact (in nanosecond units) difference between two timestamps
|
//! Returns the exact (in nanosecond units) difference between two timestamps
|
||||||
/** The difference is \a after - \a before. */
|
/** The difference is \a after - \a before. */
|
||||||
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
|
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
|
||||||
|
|
||||||
|
//! Returns the profile (colobot.ini) file location
|
||||||
|
virtual std::string profileFileLocation();
|
||||||
|
|
||||||
|
//! Returns the savegame directory location
|
||||||
|
virtual std::string savegameDirectoryLocation();
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Global function to get CSystemUtils instance
|
//! Global function to get CSystemUtils instance
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
|
#include "app/system.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <boost/property_tree/ini_parser.hpp>
|
#include <boost/property_tree/ini_parser.hpp>
|
||||||
|
@ -41,7 +43,7 @@ CProfile::~CProfile()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bp::ini_parser::write_ini("colobot.ini", m_propertyTree);
|
bp::ini_parser::write_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree);
|
||||||
}
|
}
|
||||||
catch (std::exception & e)
|
catch (std::exception & e)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +57,7 @@ bool CProfile::InitCurrentDirectory()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bp::ini_parser::read_ini("colobot.ini", m_propertyTree);
|
bp::ini_parser::read_ini(GetSystemUtils()->profileFileLocation(), m_propertyTree);
|
||||||
}
|
}
|
||||||
catch (std::exception & e)
|
catch (std::exception & e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "ui/maindialog.h"
|
#include "ui/maindialog.h"
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "app/system.h"
|
||||||
|
|
||||||
#include "common/global.h"
|
#include "common/global.h"
|
||||||
#include "common/event.h"
|
#include "common/event.h"
|
||||||
|
@ -173,7 +174,7 @@ CMainDialog::CMainDialog()
|
||||||
|
|
||||||
|
|
||||||
m_sceneDir = "levels";
|
m_sceneDir = "levels";
|
||||||
m_savegameDir = "savegame";
|
m_savegameDir = GetSystemUtils()->savegameDirectoryLocation();
|
||||||
m_publicDir = "program";
|
m_publicDir = "program";
|
||||||
m_userDir = "user";
|
m_userDir = "user";
|
||||||
m_filesDir = "files";
|
m_filesDir = "files";
|
||||||
|
|
Loading…
Reference in New Issue