diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 901d9ad42..dc58daed9 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -12,8 +12,6 @@ #include #include -#include - #if defined(_WIN32) // For OutputDebugString #define WIN32_LEAN_AND_MEAN @@ -23,17 +21,18 @@ #endif -#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix)) + #define USE_CRASH_CATCHER 1 +#else + #define USE_CRASH_CATCHER 0 +#endif + +#if USE_CRASH_CATCHER #include extern int cc_install_handlers(int argc, char **argv, int num_signals, int *sigs, const char *logfile, int (*user_info)(char*, char*)); extern int is_debugger_attached(void); #endif -// for Ogre::macBundlePath -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE -#include -#endif - #include /** * Workaround for problems with whitespaces in paths in older versions of Boost library @@ -364,7 +363,7 @@ int main(int argc, char**argv) #endif -#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#if USE_CRASH_CATCHER // Unix crash catcher if ((argc == 2 && strcmp(argv[1], "--cc-handle-crash") == 0) || !is_debugger_attached()) { @@ -376,10 +375,10 @@ int main(int argc, char**argv) std::cout << "Running in a debugger, not installing crash catcher" << std::endl; #endif -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE - // set current dir to bundle path - boost::filesystem::path bundlePath = boost::filesystem::path(Ogre::macBundlePath()).parent_path(); - boost::filesystem::current_path(bundlePath); +#ifdef __APPLE__ + // FIXME: set current dir to bundle path + //boost::filesystem::path bundlePath = boost::filesystem::path(Ogre::macBundlePath()).parent_path(); + //boost::filesystem::current_path(bundlePath); #endif engine.reset(new OMW::Engine(cfgMgr)); @@ -391,7 +390,7 @@ int main(int argc, char**argv) } catch (std::exception &e) { -#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix)) if (!isatty(fileno(stdin))) #endif SDL_ShowSimpleMessageBox(0, "OpenMW: Fatal error", e.what(), NULL); diff --git a/components/files/lowlevelfile.hpp b/components/files/lowlevelfile.hpp index d94238ad6..b2634d8c7 100644 --- a/components/files/lowlevelfile.hpp +++ b/components/files/lowlevelfile.hpp @@ -1,17 +1,15 @@ #ifndef COMPONENTS_FILES_LOWLEVELFILE_HPP #define COMPONENTS_FILES_LOWLEVELFILE_HPP -#include - #include #define FILE_API_STDIO 0 #define FILE_API_POSIX 1 #define FILE_API_WIN32 2 -#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX +#if defined(__linux) || defined(__unix) || defined(__posix) #define FILE_API FILE_API_POSIX -#elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +#elif defined(_WIN32) #define FILE_API FILE_API_WIN32 #else #define FILE_API FILE_API_STDIO