Rename some path methods

actorid
scrawl 11 years ago
parent e68e2f82a2
commit aef0fd1460

@ -26,9 +26,9 @@ ConfigurationManager::ConfigurationManager()
{ {
setupTokensMapping(); setupTokensMapping();
boost::filesystem::create_directories(mFixedPath.getUserPath()); boost::filesystem::create_directories(mFixedPath.getUserConfigPath());
mLogPath = mFixedPath.getUserPath(); mLogPath = mFixedPath.getUserConfigPath();
} }
ConfigurationManager::~ConfigurationManager() ConfigurationManager::~ConfigurationManager()
@ -39,19 +39,19 @@ void ConfigurationManager::setupTokensMapping()
{ {
mTokensMapping.insert(std::make_pair(mwToken, &FixedPath<>::getInstallPath)); mTokensMapping.insert(std::make_pair(mwToken, &FixedPath<>::getInstallPath));
mTokensMapping.insert(std::make_pair(localToken, &FixedPath<>::getLocalPath)); mTokensMapping.insert(std::make_pair(localToken, &FixedPath<>::getLocalPath));
mTokensMapping.insert(std::make_pair(userToken, &FixedPath<>::getUserPath)); mTokensMapping.insert(std::make_pair(userToken, &FixedPath<>::getUserConfigPath));
mTokensMapping.insert(std::make_pair(globalToken, &FixedPath<>::getGlobalDataPath)); mTokensMapping.insert(std::make_pair(globalToken, &FixedPath<>::getGlobalDataPath));
} }
void ConfigurationManager::readConfiguration(boost::program_options::variables_map& variables, void ConfigurationManager::readConfiguration(boost::program_options::variables_map& variables,
boost::program_options::options_description& description) boost::program_options::options_description& description)
{ {
loadConfig(mFixedPath.getUserPath(), variables, description); loadConfig(mFixedPath.getUserConfigPath(), variables, description);
boost::program_options::notify(variables); boost::program_options::notify(variables);
loadConfig(mFixedPath.getLocalPath(), variables, description); loadConfig(mFixedPath.getLocalPath(), variables, description);
boost::program_options::notify(variables); boost::program_options::notify(variables);
loadConfig(mFixedPath.getGlobalPath(), variables, description); loadConfig(mFixedPath.getGlobalConfigPath(), variables, description);
boost::program_options::notify(variables); boost::program_options::notify(variables);
} }
@ -141,12 +141,12 @@ void ConfigurationManager::loadConfig(const boost::filesystem::path& path,
const boost::filesystem::path& ConfigurationManager::getGlobalPath() const const boost::filesystem::path& ConfigurationManager::getGlobalPath() const
{ {
return mFixedPath.getGlobalPath(); return mFixedPath.getGlobalConfigPath();
} }
const boost::filesystem::path& ConfigurationManager::getUserPath() const const boost::filesystem::path& ConfigurationManager::getUserPath() const
{ {
return mFixedPath.getUserPath(); return mFixedPath.getUserConfigPath();
} }
const boost::filesystem::path& ConfigurationManager::getLocalPath() const const boost::filesystem::path& ConfigurationManager::getLocalPath() const

@ -48,8 +48,8 @@ struct FixedPath
*/ */
FixedPath(const std::string& application_name) FixedPath(const std::string& application_name)
: mPath(application_name + "/") : mPath(application_name + "/")
, mUserPath(mPath.getUserPath()) , mUserPath(mPath.getUserConfigPath())
, mGlobalPath(mPath.getGlobalPath()) , mGlobalConfigPath(mPath.getGlobalConfigPath())
, mLocalPath(mPath.getLocalPath()) , mLocalPath(mPath.getLocalPath())
, mGlobalDataPath(mPath.getGlobalDataPath()) , mGlobalDataPath(mPath.getGlobalDataPath())
, mInstallPath(mPath.getInstallPath()) , mInstallPath(mPath.getInstallPath())
@ -62,7 +62,7 @@ struct FixedPath
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
const boost::filesystem::path& getUserPath() const const boost::filesystem::path& getUserConfigPath() const
{ {
return mUserPath; return mUserPath;
} }
@ -72,9 +72,9 @@ struct FixedPath
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
const boost::filesystem::path& getGlobalPath() const const boost::filesystem::path& getGlobalConfigPath() const
{ {
return mGlobalPath; return mGlobalConfigPath;
} }
/** /**
@ -106,7 +106,7 @@ struct FixedPath
PathType mPath; PathType mPath;
boost::filesystem::path mUserPath; /**< User path */ boost::filesystem::path mUserPath; /**< User path */
boost::filesystem::path mGlobalPath; /**< Global path */ boost::filesystem::path mGlobalConfigPath; /**< Global path */
boost::filesystem::path mLocalPath; /**< It is the same directory where application was run */ boost::filesystem::path mLocalPath; /**< It is the same directory where application was run */
boost::filesystem::path mGlobalDataPath; /**< Global application data path */ boost::filesystem::path mGlobalDataPath; /**< Global application data path */

@ -19,7 +19,7 @@ LinuxPath::LinuxPath(const std::string& application_name)
{ {
} }
boost::filesystem::path LinuxPath::getUserPath() const boost::filesystem::path LinuxPath::getUserConfigPath() const
{ {
boost::filesystem::path userPath("."); boost::filesystem::path userPath(".");
@ -63,7 +63,7 @@ boost::filesystem::path LinuxPath::getCachePath() const
return userPath / ".cache" / mName; return userPath / ".cache" / mName;
} }
boost::filesystem::path LinuxPath::getGlobalPath() const boost::filesystem::path LinuxPath::getGlobalConfigPath() const
{ {
boost::filesystem::path globalPath("/etc/"); boost::filesystem::path globalPath("/etc/");
return globalPath / mName; return globalPath / mName;

@ -20,44 +20,32 @@ struct LinuxPath
/** /**
* \brief Return path to the user directory. * \brief Return path to the user directory.
*
* \return boost::filesystem::path
*/ */
boost::filesystem::path getUserPath() const; boost::filesystem::path getUserConfigPath() const;
/** /**
* \brief Return path to the global (system) directory where game files could be placed. * \brief Return path to the global (system) directory where config files can be placed.
*
* \return boost::filesystem::path
*/ */
boost::filesystem::path getGlobalPath() const; boost::filesystem::path getGlobalConfigPath() const;
/** /**
* \brief Return path to the runtime configuration directory which is the * \brief Return path to the runtime configuration directory which is the
* place where an application was started. * place where an application was started.
*
* \return boost::filesystem::path
*/ */
boost::filesystem::path getLocalPath() const; boost::filesystem::path getLocalPath() const;
/** /**
* \brief * \brief Return path to the global (system) directory where game files can be placed.
*
* \return boost::filesystem::path
*/ */
boost::filesystem::path getGlobalDataPath() const; boost::filesystem::path getGlobalDataPath() const;
/** /**
* \brief * \brief
*
* \return boost::filesystem::path
*/ */
boost::filesystem::path getCachePath() const; boost::filesystem::path getCachePath() const;
/** /**
* \brief Gets the path of the installed Morrowind version if there is one. * \brief Gets the path of the installed Morrowind version if there is one.
*
* \return boost::filesystem::path
*/ */
boost::filesystem::path getInstallPath() const; boost::filesystem::path getInstallPath() const;

@ -22,7 +22,7 @@ MacOsPath::MacOsPath(const std::string& application_name)
{ {
} }
boost::filesystem::path MacOsPath::getUserPath() const boost::filesystem::path MacOsPath::getUserConfigPath() const
{ {
boost::filesystem::path userPath("."); boost::filesystem::path userPath(".");
@ -43,7 +43,7 @@ boost::filesystem::path MacOsPath::getUserPath() const
return userPath / mName; return userPath / mName;
} }
boost::filesystem::path MacOsPath::getGlobalPath() const boost::filesystem::path MacOsPath::getGlobalConfigPath() const
{ {
boost::filesystem::path globalPath("/Library/Preferences/"); boost::filesystem::path globalPath("/Library/Preferences/");
return globalPath / mName; return globalPath / mName;

@ -23,14 +23,14 @@ struct MacOsPath
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
boost::filesystem::path getUserPath() const; boost::filesystem::path getUserConfigPath() const;
/** /**
* \brief Return path to the global (system) directory. * \brief Return path to the global (system) directory.
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
boost::filesystem::path getGlobalPath() const; boost::filesystem::path getGlobalConfigPath() const;
/** /**
* \brief Return path to the runtime directory which is the * \brief Return path to the runtime directory which is the

@ -25,7 +25,7 @@ WindowsPath::WindowsPath(const std::string& application_name)
{ {
} }
boost::filesystem::path WindowsPath::getUserPath() const boost::filesystem::path WindowsPath::getUserConfigPath() const
{ {
boost::filesystem::path userPath("."); boost::filesystem::path userPath(".");
@ -41,7 +41,7 @@ boost::filesystem::path WindowsPath::getUserPath() const
return userPath / mName; return userPath / mName;
} }
boost::filesystem::path WindowsPath::getGlobalPath() const boost::filesystem::path WindowsPath::getGlobalConfigPath() const
{ {
boost::filesystem::path globalPath("."); boost::filesystem::path globalPath(".");

@ -29,14 +29,14 @@ struct WindowsPath
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
boost::filesystem::path getUserPath() const; boost::filesystem::path getUserConfigPath() const;
/** /**
* \brief Returns "X:\Program Files\" * \brief Returns "X:\Program Files\"
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
boost::filesystem::path getGlobalPath() const; boost::filesystem::path getGlobalConfigPath() const;
/** /**
* \brief Return local path which is a location where * \brief Return local path which is a location where

Loading…
Cancel
Save