2009-09-07 19:23:46 +00:00
|
|
|
#include "AppConfig.h"
|
|
|
|
#include "PathUtils.h"
|
|
|
|
|
2023-08-28 16:55:00 +02:00
|
|
|
#define BASE_DATA_PATH ("Play Data Files")
|
2023-08-30 17:35:10 -04:00
|
|
|
#define CONFIG_FILENAME ("config.xml")
|
2009-09-07 19:23:46 +00:00
|
|
|
|
2012-08-23 01:49:03 +00:00
|
|
|
CAppConfig::CAppConfig()
|
2018-04-30 21:01:23 +01:00
|
|
|
: CConfig(BuildConfigPath())
|
2009-09-07 19:23:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-08-30 17:35:10 -04:00
|
|
|
Framework::CConfig::PathType CAppConfig::BuildConfigPath()
|
2009-09-07 19:23:46 +00:00
|
|
|
{
|
2023-08-30 17:35:10 -04:00
|
|
|
return GetBasePath() / CONFIG_FILENAME;
|
|
|
|
}
|
2023-08-28 16:55:00 +02:00
|
|
|
|
2023-08-30 17:35:10 -04:00
|
|
|
CAppConfigBasePath::CAppConfigBasePath()
|
|
|
|
{
|
|
|
|
if(fs::exists("portable.txt"))
|
|
|
|
{
|
|
|
|
m_basePath = BASE_DATA_PATH;
|
2023-08-28 16:55:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-08-30 17:35:10 -04:00
|
|
|
m_basePath = Framework::PathUtils::GetPersonalDataPath() / BASE_DATA_PATH;
|
2023-08-28 16:55:00 +02:00
|
|
|
}
|
2023-08-30 17:35:10 -04:00
|
|
|
Framework::PathUtils::EnsurePathExists(m_basePath);
|
2009-09-07 19:23:46 +00:00
|
|
|
}
|
|
|
|
|
2023-08-30 17:35:10 -04:00
|
|
|
fs::path CAppConfigBasePath::GetBasePath() const
|
2009-09-07 19:23:46 +00:00
|
|
|
{
|
2023-08-30 17:35:10 -04:00
|
|
|
return m_basePath;
|
2009-09-07 19:23:46 +00:00
|
|
|
}
|