mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:15:37 +00:00
adjusted components/files namespace; some related cleanup
This commit is contained in:
parent
7131c08ca4
commit
bdfd28f44d
4 changed files with 23 additions and 28 deletions
|
@ -323,12 +323,10 @@ void OMW::Engine::go()
|
|||
test.name = "";
|
||||
total = 0;
|
||||
|
||||
|
||||
|
||||
std::cout << "Data directory: " << mDataDir << "\n";
|
||||
|
||||
std::string cfgDir = OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH, "openmw", "");
|
||||
std::string cfgUserDir = OMW::Path::getPath(OMW::Path::USER_CFG_PATH, "openmw", "");
|
||||
std::string cfgDir = Files::getPath (Files::Path_ConfigUser, "openmw", "");
|
||||
std::string cfgUserDir = Files::getPath (Files::Path_ConfigGlobal, "openmw", "");
|
||||
std::string plugCfg = "plugins.cfg";
|
||||
std::string ogreCfg = "ogre.cfg";
|
||||
ogreCfg.insert(0, cfgUserDir);
|
||||
|
|
|
@ -79,12 +79,12 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
|
|||
std::string cfgFile = "openmw.cfg";
|
||||
if(!isFile(cfgFile.c_str()))
|
||||
{
|
||||
cfgFile = OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH, "openmw", "openmw.cfg");
|
||||
cfgFile = Files::getPath (Files::Path_ConfigGlobal, "openmw", "openmw.cfg");
|
||||
}
|
||||
std::cout << "Using global config file: " << cfgFile << std::endl;
|
||||
std::ifstream globalConfigFile(cfgFile.c_str());
|
||||
|
||||
cfgFile = OMW::Path::getPath(OMW::Path::USER_CFG_PATH, "openmw", "openmw.cfg");
|
||||
cfgFile = Files::getPath (Files::Path_ConfigUser, "openmw", "openmw.cfg");
|
||||
std::cout << "Using user config file: " << cfgFile << std::endl;
|
||||
std::ifstream userConfigFile(cfgFile.c_str());
|
||||
|
||||
|
|
|
@ -2,15 +2,21 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <OgrePlatform.h>
|
||||
#include <string>
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
#include <OSX/macUtils.h>
|
||||
#endif
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||
#include <stdlib.h> //getenv
|
||||
#endif
|
||||
|
||||
|
||||
std::string OMW::Path::getPath(PathTypeEnum parType, const std::string parApp, const std::string parFile)
|
||||
std::string Files::getPath (PathTypeEnum parType, const std::string parApp, const std::string parFile)
|
||||
{
|
||||
std::string theBasePath;
|
||||
if(parType == GLOBAL_CFG_PATH)
|
||||
if (parType==Path_ConfigGlobal)
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX?
|
||||
|
@ -21,7 +27,7 @@ std::string OMW::Path::getPath(PathTypeEnum parType, const std::string parApp, c
|
|||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
else if (parType==Path_ConfigUser)
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX?
|
||||
|
@ -53,4 +59,3 @@ std::string OMW::Path::getPath(PathTypeEnum parType, const std::string parApp, c
|
|||
theBasePath.append(parFile);
|
||||
return theBasePath;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
#ifndef PATH__HPP
|
||||
#define PATH__HPP
|
||||
#ifndef COMPONENTS_FILES_PATH_HPP
|
||||
#define COMPONENTS_FILES_PATH_HPP
|
||||
|
||||
#include <OgrePlatform.h>
|
||||
#include <string>
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
#include <OSX/macUtils.h>
|
||||
#endif
|
||||
|
||||
namespace OMW
|
||||
namespace Files
|
||||
{
|
||||
class Path
|
||||
enum PathTypeEnum
|
||||
{
|
||||
public:
|
||||
enum PathTypeEnum
|
||||
{
|
||||
USER_CFG_PATH,
|
||||
GLOBAL_CFG_PATH
|
||||
};
|
||||
|
||||
static std::string getPath(PathTypeEnum parType, const std::string parApp, const std::string parFile);
|
||||
Path_ConfigUser,
|
||||
Path_ConfigGlobal
|
||||
};
|
||||
|
||||
std::string getPath (PathTypeEnum parType, const std::string parApp, const std::string parFile);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue