Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 24, 2009, 8:17:56 PM (15 years ago)
Author:
rgrieder
Message:

Merged revision 5641 to resource3:

  • Prepared build system for an external media directory.
Location:
code/branches/resource3/src/core
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource3/src/core/ConfigFileManager.cc

    r3370 r5679  
    230230        {
    231231            // Try to get default one from the media folder
    232             boost::filesystem::path defaultFilepath(Core::getMediaPath() / "defaultConfig" / this->filename_);
     232            boost::filesystem::path defaultFilepath(Core::getExternalMediaPath() / "defaultConfig" / this->filename_);
    233233            if (boost::filesystem::exists(defaultFilepath))
    234234            {
  • code/branches/resource3/src/core/Core.cc

    r5678 r5679  
    8585    Core* Core::singletonPtr_s  = 0;
    8686
    87     SetCommandLineArgument(mediaPath, "").information("Path to the media/data files");
     87    SetCommandLineArgument(externalMediaPath, "").information("Path to the external media files");
    8888    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
    8989    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
     
    110110            this->setConfigValues();
    111111
    112             // Possible media path override by the command line
    113             if (!CommandLine::getArgument("mediaPath")->hasDefaultValue())
    114                 tsetMediaPath(CommandLine::getValue("mediaPath"));
     112            // External media directory only exists for dev runs
     113            if (Core::isDevelopmentRun())
     114            {
     115                // Possible media path override by the command line
     116                if (!CommandLine::getArgument("externalMediaPath")->hasDefaultValue())
     117                    tsetExternalMediaPath(CommandLine::getValue("externalMediaPath"));
     118            }
    115119        }
    116120
     
    145149                .description("If true, all random actions are different each time you start the game")
    146150                .callback(this, &CoreConfiguration::initializeRandomNumberGenerator);
    147 
    148             // Only show this config value for development builds
    149             if (Core::isDevelopmentRun())
    150             {
    151                 SetConfigValue(mediaPathString_, mediaPath_.string())
    152                     .description("Relative path to the game data.")
    153                     .callback(this, &CoreConfiguration::mediaPathChanged);
    154             }
    155151        }
    156152
     
    183179
    184180        /**
    185         @brief
    186             Callback function if the media path has changed.
    187         */
    188         void mediaPathChanged()
    189         {
    190             mediaPath_ = boost::filesystem::path(this->mediaPathString_);
    191         }
    192 
    193         /**
    194181            @brief Sets the language in the config-file back to the default.
    195182        */
     
    205192            The new media path
    206193        */
    207         void tsetMediaPath(const std::string& path)
    208         {
    209             if (Core::isDevelopmentRun())
    210             {
    211                 ModifyConfigValue(mediaPathString_, tset, path);
    212             }
    213             else
    214             {
    215                 // Manual 'config' value without the file entry
    216                 mediaPathString_ = path;
    217                 this->mediaPathChanged();
    218             }
     194        void tsetExternalMediaPath(const std::string& path)
     195        {
     196            mediaPath_ = boost::filesystem::path(path);
    219197        }
    220198
     
    236214        std::string language_;                          //!< The language
    237215        bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
    238         std::string mediaPathString_;                   //!< Path to the data/media file folder as string
    239216
    240217        //! Path to the parent directory of the ones above if program was installed with relativ pahts
     
    242219        boost::filesystem::path executablePath_;        //!< Path to the executable
    243220        boost::filesystem::path mediaPath_;             //!< Path to the media file folder
     221        boost::filesystem::path externalMediaPath_;     //!< Path to the media file folder
    244222        boost::filesystem::path configPath_;            //!< Path to the config file folder
    245223        boost::filesystem::path logPath_;               //!< Path to the log file folder
     
    311289
    312290        // initialise Tcl
    313         this->tclBind_.reset(new TclBind(Core::getMediaPathString()));
     291        this->tclBind_.reset(new TclBind(Core::getExternalMediaPathString()));
    314292        this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
    315293
     
    427405    }
    428406
    429     /*static*/ void Core::tsetMediaPath(const std::string& path)
    430     {
    431         getInstance().configuration_->tsetMediaPath(path);
     407    /*static*/ void Core::tsetExternalMediaPath(const std::string& path)
     408    {
     409        getInstance().configuration_->tsetExternalMediaPath(path);
    432410    }
    433411
     
    439417    {
    440418        return getInstance().configuration_->mediaPath_.string() + '/';
     419    }
     420
     421    /*static*/ const boost::filesystem::path& Core::getExternalMediaPath()
     422    {
     423        return getInstance().configuration_->externalMediaPath_;
     424    }
     425    /*static*/ std::string Core::getExternalMediaPathString()
     426    {
     427        return getInstance().configuration_->externalMediaPath_.string() + '/';
    441428    }
    442429
     
    578565            COUT(1) << "Running from the build tree." << std::endl;
    579566            Core::bDevRun_ = true;
    580             configuration_->mediaPath_  = ORXONOX_MEDIA_DEV_PATH;
    581             configuration_->configPath_ = ORXONOX_CONFIG_DEV_PATH;
    582             configuration_->logPath_    = ORXONOX_LOG_DEV_PATH;
     567            configuration_->mediaPath_  = specialConfig::mediaDevDirectory;
     568            configuration_->externalMediaPath_ = specialConfig::externalMediaDevDirectory;
     569            configuration_->configPath_ = specialConfig::configDevDirectory;
     570            configuration_->logPath_    = specialConfig::logDevDirectory;
    583571        }
    584572        else
     
    586574#ifdef INSTALL_COPYABLE // --> relative paths
    587575            // Also set the root path
    588             boost::filesystem::path relativeExecutablePath(ORXONOX_RUNTIME_INSTALL_PATH);
     576            boost::filesystem::path relativeExecutablePath(specialConfig::defaultRuntimePath);
    589577            configuration_->rootPath_ = configuration_->executablePath_;
    590578            while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_)
     
    595583
    596584            // Using paths relative to the install prefix, complete them
    597             configuration_->mediaPath_  = configuration_->rootPath_ / ORXONOX_MEDIA_INSTALL_PATH;
    598             configuration_->configPath_ = configuration_->rootPath_ / ORXONOX_CONFIG_INSTALL_PATH;
    599             configuration_->logPath_    = configuration_->rootPath_ / ORXONOX_LOG_INSTALL_PATH;
     585            configuration_->mediaPath_  = configuration_->rootPath_ / specialConfig::defaultMediaPath;
     586            configuration_->configPath_ = configuration_->rootPath_ / specialConfig::defaultConfigPath;
     587            configuration_->logPath_    = configuration_->rootPath_ / specialConfig::defaultLogPath;
    600588#else
    601589            // There is no root path, so don't set it at all
    602590
    603             configuration_->mediaPath_  = ORXONOX_MEDIA_INSTALL_PATH;
     591            configuration_->mediaPath_  = specialConfig::mediaInstallDirectory;
    604592
    605593            // Get user directory
     
    614602            userDataPath /= ".orxonox";
    615603
    616             configuration_->configPath_ = userDataPath / ORXONOX_CONFIG_INSTALL_PATH;
    617             configuration_->logPath_    = userDataPath / ORXONOX_LOG_INSTALL_PATH;
     604            configuration_->configPath_ = userDataPath / specialConfig::defaultConfigPath;
     605            configuration_->logPath_    = userDataPath / specialConfig::defaultLogPath;
    618606#endif
    619607        }
  • code/branches/resource3/src/core/Core.h

    r5677 r5679  
    8989            static void  resetLanguage();
    9090
    91             static void tsetMediaPath(const std::string& path);
    92             //! Returns the path to the config files as boost::filesystem::path
     91            static void tsetExternalMediaPath(const std::string& path);
     92            //! Returns the path to the data files as boost::filesystem::path
    9393            static const boost::filesystem::path& getMediaPath();
     94            //! Returns the path to the external data files as boost::filesystem::path
     95            static const boost::filesystem::path& getExternalMediaPath();
    9496            //! Returns the path to the config files as boost::filesystem::path
    9597            static const boost::filesystem::path& getConfigPath();
    9698            //! Returns the path to the log files as boost::filesystem::path
    9799            static const boost::filesystem::path& getLogPath();
     100            //! Returns the path to the data files as std::string
    98101            //! Returns the path to the root folder as boost::filesystem::path
    99102            static const boost::filesystem::path& getRootPath();
    100             //! Returns the path to the data files as std::string
    101103            static std::string getMediaPathString();
     104            //! Returns the path to the external data files as std::string
     105            static std::string getExternalMediaPathString();
    102106            //! Returns the path to the config files as std::string
    103107            static std::string getConfigPathString();
  • code/branches/resource3/src/core/GUIManager.cc

    r3370 r5679  
    171171    {
    172172        // set datapath for GUI data
    173         lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str());
     173        lua_pushfstring(this->scriptModule_->getLuaState(), Core::getExternalMediaPathString().c_str());
    174174        lua_setglobal(this->scriptModule_->getLuaState(), "datapath");
    175175        // call main Lua script
  • code/branches/resource3/src/core/GraphicsManager.cc

    r5677 r5679  
    117117        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
    118118            .description("Location of the Ogre config file");
    119         SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
     119        SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)
    120120            .description("Folder where the Ogre plugins are located.");
    121         SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
     121        SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins)
    122122            .description("Comma separated list of all plugins to load.");
    123123        SetConfigValue(ogreLogFile_,     "ogre.log")
     
    204204    {
    205205        // just to make sure the next statement doesn't segfault
    206         if (ogrePluginsFolder_ == "")
    207             ogrePluginsFolder_ = ".";
    208 
    209         boost::filesystem::path folder(ogrePluginsFolder_);
     206        if (ogrePluginsDirectory_ == "")
     207            ogrePluginsDirectory_ = ".";
     208
     209        boost::filesystem::path folder(ogrePluginsDirectory_);
    210210        // Do some SubString magic to get the comma separated list of plugins
    211211        SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '(', ')', false, '\0');
     
    231231        try
    232232        {
    233             cf.load((Core::getMediaPath() / resourceFile_).string());
     233            cf.load((Core::getExternalMediaPath() / resourceFile_).string());
    234234        }
    235235        catch (...)
     
    257257
    258258                    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
    259                         (Core::getMediaPath() / archName).string(), typeName, secName);
     259                        (Core::getExternalMediaPath() / archName).string(), typeName, secName);
    260260                }
    261261            }
  • code/branches/resource3/src/core/GraphicsManager.h

    r5677 r5679  
    101101        std::string         resourceFile_;             //!< resources file name
    102102        std::string         ogreConfigFile_;           //!< ogre config file name
    103         std::string         ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
     103        std::string         ogrePluginsDirectory_;     //!< Directory where the Ogre plugins are located
    104104        std::string         ogrePlugins_;              //!< Comma separated list of all plugins to load
    105105        std::string         ogreLogFile_;              //!< log file name for Ogre log messages
  • code/branches/resource3/src/core/LuaBind.cc

    r3370 r5679  
    4747  LuaBind::LuaBind()
    4848  {
    49     this->includePath_ = Core::getMediaPathString();
     49    this->includePath_ = Core::getExternalMediaPathString();
    5050
    5151    luaState_ = lua_open();
  • code/branches/resource3/src/core/TclBind.cc

    r3370 r5679  
    127127#ifdef DEPENDENCY_PACKAGE_ENABLE
    128128        if (Core::isDevelopmentRun())
    129             return (std::string(ORXONOX_DEP_LIB_PATH) + "/tcl");
     129            return (std::string(specialConfig::dependencyLibraryDirectory) + "/tcl");
    130130        else
    131131            return (Core::getRootPathString() + "lib/tcl");
Note: See TracChangeset for help on using the changeset viewer.