mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 16:06:44 +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 = "";
|
test.name = "";
|
||||||
total = 0;
|
total = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::cout << "Data directory: " << mDataDir << "\n";
|
std::cout << "Data directory: " << mDataDir << "\n";
|
||||||
|
|
||||||
std::string cfgDir = OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH, "openmw", "");
|
std::string cfgDir = Files::getPath (Files::Path_ConfigUser, "openmw", "");
|
||||||
std::string cfgUserDir = OMW::Path::getPath(OMW::Path::USER_CFG_PATH, "openmw", "");
|
std::string cfgUserDir = Files::getPath (Files::Path_ConfigGlobal, "openmw", "");
|
||||||
std::string plugCfg = "plugins.cfg";
|
std::string plugCfg = "plugins.cfg";
|
||||||
std::string ogreCfg = "ogre.cfg";
|
std::string ogreCfg = "ogre.cfg";
|
||||||
ogreCfg.insert(0, cfgUserDir);
|
ogreCfg.insert(0, cfgUserDir);
|
||||||
|
|
|
@ -79,12 +79,12 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
|
||||||
std::string cfgFile = "openmw.cfg";
|
std::string cfgFile = "openmw.cfg";
|
||||||
if(!isFile(cfgFile.c_str()))
|
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::cout << "Using global config file: " << cfgFile << std::endl;
|
||||||
std::ifstream globalConfigFile(cfgFile.c_str());
|
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::cout << "Using user config file: " << cfgFile << std::endl;
|
||||||
std::ifstream userConfigFile(cfgFile.c_str());
|
std::ifstream userConfigFile(cfgFile.c_str());
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,21 @@
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#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
|
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||||
#include <stdlib.h> //getenv
|
#include <stdlib.h> //getenv
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::string Files::getPath (PathTypeEnum parType, const std::string parApp, const std::string parFile)
|
||||||
std::string OMW::Path::getPath(PathTypeEnum parType, const std::string parApp, const std::string parFile)
|
|
||||||
{
|
{
|
||||||
std::string theBasePath;
|
std::string theBasePath;
|
||||||
if(parType == GLOBAL_CFG_PATH)
|
if (parType==Path_ConfigGlobal)
|
||||||
{
|
{
|
||||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||||
theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX?
|
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
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else if (parType==Path_ConfigUser)
|
||||||
{
|
{
|
||||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||||
theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX?
|
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);
|
theBasePath.append(parFile);
|
||||||
return theBasePath;
|
return theBasePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
#ifndef PATH__HPP
|
#ifndef COMPONENTS_FILES_PATH_HPP
|
||||||
#define PATH__HPP
|
#define COMPONENTS_FILES_PATH_HPP
|
||||||
|
|
||||||
#include <OgrePlatform.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
namespace Files
|
||||||
#include <OSX/macUtils.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace OMW
|
|
||||||
{
|
{
|
||||||
class Path
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum PathTypeEnum
|
enum PathTypeEnum
|
||||||
{
|
{
|
||||||
USER_CFG_PATH,
|
Path_ConfigUser,
|
||||||
GLOBAL_CFG_PATH
|
Path_ConfigGlobal
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string getPath(PathTypeEnum parType, const std::string parApp, const std::string parFile);
|
std::string getPath (PathTypeEnum parType, const std::string parApp, const std::string parFile);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue