diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 39ab43008..c6b57efc0 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -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); diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 754627602..c5f53d7b5 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -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()); diff --git a/components/files/path.cpp b/components/files/path.cpp index e7dbc0471..a7b66822f 100644 --- a/components/files/path.cpp +++ b/components/files/path.cpp @@ -2,15 +2,21 @@ #include +#include +#include + +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#include +#endif + #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX #include //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; } - diff --git a/components/files/path.hpp b/components/files/path.hpp index 84ff9ecab..a42646404 100644 --- a/components/files/path.hpp +++ b/components/files/path.hpp @@ -1,25 +1,17 @@ -#ifndef PATH__HPP -#define PATH__HPP +#ifndef COMPONENTS_FILES_PATH_HPP +#define COMPONENTS_FILES_PATH_HPP -#include #include -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE -#include -#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