mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Merge branch 'config'
This commit is contained in:
commit
7f0a75c803
@ -14,15 +14,15 @@ find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||
# Location of morrowind data files
|
||||
if(DPKG_PROGRAM)
|
||||
set(MORROWIND_DATA_FILES "/usr/share/games/openmw/data/" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "/usr/share/games/openmw/resources/" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "/usr/share/games/openmw/resources/" CACHE PATH "location of OpenMW resources files")
|
||||
else()
|
||||
if (APPLE)
|
||||
# set path inside bundle
|
||||
set(MORROWIND_DATA_FILES "../data" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "Contents/Resources/resources" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "Contents/Resources/resources" CACHE PATH "location of OpenMW resources files")
|
||||
else()
|
||||
set(MORROWIND_DATA_FILES "data" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of OpenMW resources files")
|
||||
endif(APPLE)
|
||||
endif(DPKG_PROGRAM)
|
||||
|
||||
@ -181,6 +181,14 @@ set(MISC_HEADER
|
||||
${COMP_DIR}/misc/stringops.hpp)
|
||||
source_group(components\\misc FILES ${MISC} ${MISC_HEADER})
|
||||
|
||||
set(FILES
|
||||
${COMP_DIR}/files/path.cpp
|
||||
)
|
||||
set(FILES_HEADER
|
||||
${COMP_DIR}/files/path.hpp
|
||||
)
|
||||
source_group(components\\files FILES ${FILES} ${FILES_HEADER})
|
||||
|
||||
file(GLOB COMPILER ${COMP_DIR}/compiler/*.cpp)
|
||||
file(GLOB COMPILER_HEADER ${COMP_DIR}/compiler/*.hpp)
|
||||
source_group(components\\compiler FILES ${COMPILER} ${COMPILER_HEADER})
|
||||
@ -190,10 +198,10 @@ file(GLOB INTERPRETER_HEADER ${COMP_DIR}/interpreter/*.hpp)
|
||||
source_group(components\\interpreter FILES ${INTERPRETER} ${INTERPRETER_HEADER})
|
||||
|
||||
set(COMPONENTS ${BSA} ${NIF} ${NIFOGRE} ${ESM_STORE} ${MISC} ${TO_UTF8}
|
||||
${COMPILER} ${INTERPRETER} ${ESM} ${FILE_FINDER} ${NIFBULLET})
|
||||
${COMPILER} ${INTERPRETER} ${ESM} ${FILE_FINDER} ${NIFBULLET} ${FILES})
|
||||
set(COMPONENTS_HEADER ${BSA_HEADER} ${NIF_HEADER} ${NIFOGRE_HEADER} ${ESM_STORE_HEADER}
|
||||
${ESM_HEADER} ${MISC_HEADER} ${COMPILER_HEADER} ${TO_UTF8_HEADER}
|
||||
${INTERPRETER_HEADER} ${FILE_FINDER_HEADER} ${NIFBULLET_HEADER})
|
||||
${INTERPRETER_HEADER} ${FILE_FINDER_HEADER} ${NIFBULLET_HEADER} ${FILES_HEADER})
|
||||
|
||||
# source directory: libs
|
||||
|
||||
@ -336,6 +344,11 @@ endif (APPLE)
|
||||
|
||||
# Other files
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg.local
|
||||
"${OpenMW_BINARY_DIR}/openmw.cfg")
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
|
||||
"${OpenMW_BINARY_DIR}/openmw.cfg.install")
|
||||
|
||||
if (WIN32)
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.win32
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg" COPYONLY)
|
||||
@ -424,7 +437,7 @@ if(DPKG_PROGRAM)
|
||||
endif()
|
||||
|
||||
#Install global configuration files
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "../etc/openmw/" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
|
||||
#Install resources
|
||||
|
@ -5,7 +5,7 @@ project(OpenMW)
|
||||
set(GAME
|
||||
main.cpp
|
||||
engine.cpp
|
||||
path.cpp)
|
||||
)
|
||||
set(GAME_HEADER
|
||||
engine.hpp)
|
||||
source_group(game FILES ${GAME} ${GAME_HEADER})
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <components/bsa/bsa_archive.hpp>
|
||||
#include <components/esm/loadregn.hpp>
|
||||
#include <components/esm/esm_reader.hpp>
|
||||
#include <components/files/path.hpp>
|
||||
|
||||
#include <openengine/gui/manager.hpp>
|
||||
#include "mwgui/window_manager.hpp"
|
||||
|
||||
@ -47,7 +49,6 @@
|
||||
|
||||
#include <MyGUI_WidgetManager.h>
|
||||
#include "mwgui/class.hpp"
|
||||
#include "path.hpp"
|
||||
|
||||
#include "components/nifbullet/bullet_nif_loader.hpp"
|
||||
|
||||
@ -322,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_ConfigGlobal, "openmw", "");
|
||||
std::string cfgUserDir = Files::getPath (Files::Path_ConfigUser, "openmw", "");
|
||||
std::string plugCfg = "plugins.cfg";
|
||||
std::string ogreCfg = "ogre.cfg";
|
||||
ogreCfg.insert(0, cfgUserDir);
|
||||
|
@ -6,8 +6,9 @@
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <components/misc/fileops.hpp>
|
||||
#include <components/files/path.hpp>
|
||||
|
||||
#include "engine.hpp"
|
||||
#include "path.hpp"
|
||||
|
||||
#if defined(_WIN32) && !defined(_CONSOLE)
|
||||
#include <boost/iostreams/concepts.hpp>
|
||||
@ -73,11 +74,17 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
|
||||
|
||||
bpo::variables_map variables;
|
||||
|
||||
std::string cfgFile = OMW::Path::getPath(OMW::Path::GLOBAL_CFG_PATH, "openmw", "openmw.cfg");
|
||||
//If there is an openmw.cfg in the current path use that as global config
|
||||
//Otherwise try getPath
|
||||
std::string cfgFile = "openmw.cfg";
|
||||
if(!isFile(cfgFile.c_str()))
|
||||
{
|
||||
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());
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
#ifndef PATH__HPP
|
||||
#define PATH__HPP
|
||||
|
||||
#include <OgrePlatform.h>
|
||||
#include <string>
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
#include <OSX/macUtils.h>
|
||||
#endif
|
||||
|
||||
namespace OMW
|
||||
{
|
||||
class Path
|
||||
{
|
||||
public:
|
||||
enum PathTypeEnum
|
||||
{
|
||||
USER_CFG_PATH,
|
||||
GLOBAL_CFG_PATH
|
||||
};
|
||||
|
||||
static std::string getPath(PathTypeEnum parType, const std::string parApp, const std::string parFile);
|
||||
};
|
||||
}
|
||||
#endif
|
@ -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;
|
||||
}
|
||||
|
17
components/files/path.hpp
Normal file
17
components/files/path.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef COMPONENTS_FILES_PATH_HPP
|
||||
#define COMPONENTS_FILES_PATH_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Files
|
||||
{
|
||||
enum PathTypeEnum
|
||||
{
|
||||
Path_ConfigUser,
|
||||
Path_ConfigGlobal
|
||||
};
|
||||
|
||||
std::string getPath (PathTypeEnum parType, const std::string parApp, const std::string parFile);
|
||||
}
|
||||
|
||||
#endif
|
2
files/openmw.cfg.local
Normal file
2
files/openmw.cfg.local
Normal file
@ -0,0 +1,2 @@
|
||||
data=./data
|
||||
resources=./resources
|
Loading…
x
Reference in New Issue
Block a user