On OS X openmw now sets current directory to bundle root, openmw.cfg values is relative to bundle root

actorid
Nikolay Kasyanov 14 years ago
parent 943eea8104
commit 768c9bdf07

@ -12,9 +12,15 @@ 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")
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")
endif()
if (APPLE)
# set path inside bundle
set(MORROWIND_DATA_FILES "Contents/Resources/data" CACHE PATH "location of Morrowind data files")
set(MORROWIND_RESOURCE_FILES "Contents/Resources/resources" CACHE PATH "location of Morrowind data 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")
endif(APPLE)
endif(DPKG_PROGRAM)
if (WIN32)
option(USE_DEBUG_CONSOLE "whether a debug console should be enabled for debug builds, if false debug output is redirected to Visual Studio output" ON)

@ -253,30 +253,13 @@ void OMW::Engine::addResourcesDirectory (const boost::filesystem::path& path)
void OMW::Engine::setDataDir (const boost::filesystem::path& dataDir)
{
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
// FIXME possibly hack, should use Carbon methods to get resource path
mDataDir = boost::filesystem::path(Ogre::macBundlePath() + "/Contents/Resources");
mDataDir = mDataDir / dataDir;
#else
mDataDir = boost::filesystem::system_complete (dataDir);
#endif
std::cout << "mDataDir: " << mDataDir << std::endl;
std::cout << "dataDir: " << dataDir << std::endl;
std::cout << "initial path: " << boost::filesystem::initial_path() << std::endl;
std::cout << "mac bundle path: " << Ogre::macBundlePath() << std::endl;
}
// Set resource dir
void OMW::Engine::setResourceDir (const boost::filesystem::path& parResDir)
{
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
// FIXME possibly hack, should use Carbon methods to get resource path
mResDir = boost::filesystem::path(Ogre::macBundlePath() + "/Contents/Resources");
mResDir = mResDir / parResDir;
#else
mResDir = boost::filesystem::system_complete(parResDir);
#endif
}
// Set start cell name (only interiors for now)

@ -111,11 +111,16 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
int main(int argc, char**argv)
{
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
// set current dir to bundle path
boost::filesystem::path bundlePath = boost::filesystem::path(Ogre::macBundlePath());
boost::filesystem::current_path(bundlePath);
#endif
try
{
OMW::Engine engine;
if (parseOptions (argc, argv, engine))
{
engine.go();

Loading…
Cancel
Save