Skip to content

Commit

Permalink
Rename some path methods
Browse files Browse the repository at this point in the history
  • Loading branch information
scrawl committed Dec 26, 2013
1 parent e68e2f8 commit aef0fd1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 39 deletions.
14 changes: 7 additions & 7 deletions components/files/configurationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ ConfigurationManager::ConfigurationManager()
{
setupTokensMapping();

boost::filesystem::create_directories(mFixedPath.getUserPath());
boost::filesystem::create_directories(mFixedPath.getUserConfigPath());

mLogPath = mFixedPath.getUserPath();
mLogPath = mFixedPath.getUserConfigPath();
}

ConfigurationManager::~ConfigurationManager()
Expand All @@ -39,19 +39,19 @@ void ConfigurationManager::setupTokensMapping()
{
mTokensMapping.insert(std::make_pair(mwToken, &FixedPath<>::getInstallPath));
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));
}

void ConfigurationManager::readConfiguration(boost::program_options::variables_map& variables,
boost::program_options::options_description& description)
{
loadConfig(mFixedPath.getUserPath(), variables, description);
loadConfig(mFixedPath.getUserConfigPath(), variables, description);
boost::program_options::notify(variables);

loadConfig(mFixedPath.getLocalPath(), variables, description);
boost::program_options::notify(variables);
loadConfig(mFixedPath.getGlobalPath(), variables, description);
loadConfig(mFixedPath.getGlobalConfigPath(), variables, description);
boost::program_options::notify(variables);

}
Expand Down Expand Up @@ -141,12 +141,12 @@ void ConfigurationManager::loadConfig(const boost::filesystem::path& path,

const boost::filesystem::path& ConfigurationManager::getGlobalPath() const
{
return mFixedPath.getGlobalPath();
return mFixedPath.getGlobalConfigPath();
}

const boost::filesystem::path& ConfigurationManager::getUserPath() const
{
return mFixedPath.getUserPath();
return mFixedPath.getUserConfigPath();
}

const boost::filesystem::path& ConfigurationManager::getLocalPath() const
Expand Down
12 changes: 6 additions & 6 deletions components/files/fixedpath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ struct FixedPath
*/
FixedPath(const std::string& application_name)
: mPath(application_name + "/")
, mUserPath(mPath.getUserPath())
, mGlobalPath(mPath.getGlobalPath())
, mUserPath(mPath.getUserConfigPath())
, mGlobalConfigPath(mPath.getGlobalConfigPath())
, mLocalPath(mPath.getLocalPath())
, mGlobalDataPath(mPath.getGlobalDataPath())
, mInstallPath(mPath.getInstallPath())
Expand All @@ -62,7 +62,7 @@ struct FixedPath
*
* \return boost::filesystem::path
*/
const boost::filesystem::path& getUserPath() const
const boost::filesystem::path& getUserConfigPath() const
{
return mUserPath;
}
Expand All @@ -72,9 +72,9 @@ struct FixedPath
*
* \return boost::filesystem::path
*/
const boost::filesystem::path& getGlobalPath() const
const boost::filesystem::path& getGlobalConfigPath() const
{
return mGlobalPath;
return mGlobalConfigPath;
}

/**
Expand Down Expand Up @@ -106,7 +106,7 @@ struct FixedPath
PathType mPath;

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 mGlobalDataPath; /**< Global application data path */
Expand Down
4 changes: 2 additions & 2 deletions components/files/linuxpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(".");

Expand Down Expand Up @@ -63,7 +63,7 @@ boost::filesystem::path LinuxPath::getCachePath() const
return userPath / ".cache" / mName;
}

boost::filesystem::path LinuxPath::getGlobalPath() const
boost::filesystem::path LinuxPath::getGlobalConfigPath() const
{
boost::filesystem::path globalPath("/etc/");
return globalPath / mName;
Expand Down
20 changes: 4 additions & 16 deletions components/files/linuxpath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,32 @@ struct LinuxPath

/**
* \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.
*
* \return boost::filesystem::path
* \brief Return path to the global (system) directory where config files can be placed.
*/
boost::filesystem::path getGlobalPath() const;
boost::filesystem::path getGlobalConfigPath() const;

/**
* \brief Return path to the runtime configuration directory which is the
* place where an application was started.
*
* \return boost::filesystem::path
*/
boost::filesystem::path getLocalPath() const;

/**
* \brief
*
* \return boost::filesystem::path
* \brief Return path to the global (system) directory where game files can be placed.
*/
boost::filesystem::path getGlobalDataPath() const;

/**
* \brief
*
* \return boost::filesystem::path
*/
boost::filesystem::path getCachePath() const;

/**
* \brief Gets the path of the installed Morrowind version if there is one.
*
* \return boost::filesystem::path
*/
boost::filesystem::path getInstallPath() const;

Expand Down
4 changes: 2 additions & 2 deletions components/files/macospath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(".");

Expand All @@ -43,7 +43,7 @@ boost::filesystem::path MacOsPath::getUserPath() const
return userPath / mName;
}

boost::filesystem::path MacOsPath::getGlobalPath() const
boost::filesystem::path MacOsPath::getGlobalConfigPath() const
{
boost::filesystem::path globalPath("/Library/Preferences/");
return globalPath / mName;
Expand Down
4 changes: 2 additions & 2 deletions components/files/macospath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ struct MacOsPath
*
* \return boost::filesystem::path
*/
boost::filesystem::path getUserPath() const;
boost::filesystem::path getUserConfigPath() const;

/**
* \brief Return path to the global (system) directory.
*
* \return boost::filesystem::path
*/
boost::filesystem::path getGlobalPath() const;
boost::filesystem::path getGlobalConfigPath() const;

/**
* \brief Return path to the runtime directory which is the
Expand Down
4 changes: 2 additions & 2 deletions components/files/windowspath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(".");

Expand All @@ -41,7 +41,7 @@ boost::filesystem::path WindowsPath::getUserPath() const
return userPath / mName;
}

boost::filesystem::path WindowsPath::getGlobalPath() const
boost::filesystem::path WindowsPath::getGlobalConfigPath() const
{
boost::filesystem::path globalPath(".");

Expand Down
4 changes: 2 additions & 2 deletions components/files/windowspath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ struct WindowsPath
*
* \return boost::filesystem::path
*/
boost::filesystem::path getUserPath() const;
boost::filesystem::path getUserConfigPath() const;

/**
* \brief Returns "X:\Program Files\"
*
* \return boost::filesystem::path
*/
boost::filesystem::path getGlobalPath() const;
boost::filesystem::path getGlobalConfigPath() const;

/**
* \brief Return local path which is a location where
Expand Down

0 comments on commit aef0fd1

Please sign in to comment.