Changeset 5679 for code/branches/resource3/src
- Timestamp:
- Aug 24, 2009, 8:17:56 PM (15 years ago)
- Location:
- code/branches/resource3/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource3/src/SpecialConfig.h.in
r3370 r5679 70 70 71 71 // Handle default ConfigValues 72 namespace orxonox 72 namespace orxonox { namespace specialConfig 73 73 { 74 // DEFAULT RELATIVE PATHS (might not be used at all) 75 const char defaultRuntimePath[] = "@DEFAULT_RUNTIME_PATH@"; 76 const char defaultLibraryPath[] = "@DEFAULT_LIBRARY_PATH@"; 77 const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@"; 78 const char defaultDocPath[] = "@DEFAULT_DOC_PATH@"; 79 const char defaultMediaPath[] = "@DEFAULT_MEDIA_PATH@"; 80 const char defaultConfigPath[] = "@DEFAULT_CONFIG_PATH@"; 81 const char defaultLogPath[] = "@DEFAULT_LOG_PATH@"; 82 74 83 // INSTALLATION PATHS 75 const char ORXONOX_RUNTIME_INSTALL_PATH[] = "@ORXONOX_RUNTIME_INSTALL_PATH@"; 76 const char ORXONOX_MEDIA_INSTALL_PATH[] = "@ORXONOX_MEDIA_INSTALL_PATH@"; 77 /* Config and Log path might be relative because they could be user and therefore runtime dependent */ 78 const char ORXONOX_CONFIG_INSTALL_PATH[] = "@ORXONOX_CONFIG_INSTALL_PATH@"; 79 const char ORXONOX_LOG_INSTALL_PATH[] = "@ORXONOX_LOG_INSTALL_PATH@"; 84 const char runtimeInstallDirectory[] = "@RUNTIME_INSTALL_DIRECTORY@"; 85 const char mediaInstallDirectory[] = "@MEDIA_INSTALL_DIRECTORY@"; 86 const char configInstallDirectory[] = "@CONFIG_INSTALL_DIRECTORY@"; 87 const char logInstallDirectory[] = "@LOG_INSTALL_DIRECTORY@"; 80 88 81 89 // DEVELOPMENT RUN PATHS 82 const char ORXONOX_MEDIA_DEV_PATH[] = "@CMAKE_MEDIA_OUTPUT_DIRECTORY@"; 90 const char mediaDevDirectory[] = "@MEDIA_DIRECTORY@"; 91 const char externalMediaDevDirectory[] = "@EXTERNAL_MEDIA_DIRECTORY@"; 83 92 #ifdef CMAKE_CONFIGURATION_TYPES 84 const char ORXONOX_CONFIG_DEV_PATH[]= "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);85 const char ORXONOX_LOG_DEV_PATH[]= "@CMAKE_LOG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);93 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE); 94 const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE); 86 95 #else 87 const char ORXONOX_CONFIG_DEV_PATH[]= "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";88 const char ORXONOX_LOG_DEV_PATH[]= "@CMAKE_LOG_OUTPUT_DIRECTORY@";96 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@"; 97 const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@"; 89 98 #endif 99 90 100 #ifdef DEPENDENCY_PACKAGE_ENABLE 91 const char ORXONOX_DEP_LIB_PATH[]= "@DEP_LIBRARY_DIR@";101 const char dependencyLibraryDirectory[] = "@DEP_LIBRARY_DIR@"; 92 102 #endif 93 103 94 104 // OGRE PLUGINS 95 105 #ifdef NDEBUG 96 const char ORXONOX_OGRE_PLUGINS[] = "@OGRE_PLUGINS_RELEASE@";106 const char ogrePlugins[] = "@OGRE_PLUGINS_RELEASE@"; 97 107 # ifdef DEPENDENCY_PACKAGE_ENABLE 98 const char ORXONOX_OGRE_PLUGINS_FOLDER[] = ".";108 const char ogrePluginsDirectory[] = "."; 99 109 # else 100 const char ORXONOX_OGRE_PLUGINS_FOLDER[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";110 const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_RELEASE@"; 101 111 # endif 102 112 #else 103 const char ORXONOX_OGRE_PLUGINS[] = "@OGRE_PLUGINS_DEBUG@";113 const char ogrePlugins[] = "@OGRE_PLUGINS_DEBUG@"; 104 114 # ifdef DEPENDENCY_PACKAGE_ENABLE 105 const char ORXONOX_OGRE_PLUGINS_FOLDER[] = ".";115 const char ogrePluginsDirectory[] = "."; 106 116 # else 107 const char ORXONOX_OGRE_PLUGINS_FOLDER[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";117 const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@"; 108 118 # endif 109 119 #endif 110 } 120 } } 111 121 112 122 /** -
code/branches/resource3/src/ceguilua/CMakeLists.txt
r3196 r5679 63 63 CEGUI.pkg 64 64 DEPENDS ${TOLUA_PARSER_DEPENDENCIES} 65 WORKING_DIRECTORY ${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}65 WORKING_DIRECTORY ${RUNTIME_LIBRARY_DIRECTORY} 66 66 COMMENT "Generating tolua bind files for package CEGUILua" 67 67 ) -
code/branches/resource3/src/core/ConfigFileManager.cc
r3370 r5679 230 230 { 231 231 // Try to get default one from the media folder 232 boost::filesystem::path defaultFilepath(Core::get MediaPath() / "defaultConfig" / this->filename_);232 boost::filesystem::path defaultFilepath(Core::getExternalMediaPath() / "defaultConfig" / this->filename_); 233 233 if (boost::filesystem::exists(defaultFilepath)) 234 234 { -
code/branches/resource3/src/core/Core.cc
r5678 r5679 85 85 Core* Core::singletonPtr_s = 0; 86 86 87 SetCommandLineArgument( mediaPath, "").information("Path to the media/data files");87 SetCommandLineArgument(externalMediaPath, "").information("Path to the external media files"); 88 88 SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files"); 89 89 SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file"); … … 110 110 this->setConfigValues(); 111 111 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 } 115 119 } 116 120 … … 145 149 .description("If true, all random actions are different each time you start the game") 146 150 .callback(this, &CoreConfiguration::initializeRandomNumberGenerator); 147 148 // Only show this config value for development builds149 if (Core::isDevelopmentRun())150 {151 SetConfigValue(mediaPathString_, mediaPath_.string())152 .description("Relative path to the game data.")153 .callback(this, &CoreConfiguration::mediaPathChanged);154 }155 151 } 156 152 … … 183 179 184 180 /** 185 @brief186 Callback function if the media path has changed.187 */188 void mediaPathChanged()189 {190 mediaPath_ = boost::filesystem::path(this->mediaPathString_);191 }192 193 /**194 181 @brief Sets the language in the config-file back to the default. 195 182 */ … … 205 192 The new media path 206 193 */ 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); 219 197 } 220 198 … … 236 214 std::string language_; //!< The language 237 215 bool bInitializeRandomNumberGenerator_; //!< If true, srand(time(0)) is called 238 std::string mediaPathString_; //!< Path to the data/media file folder as string239 216 240 217 //! Path to the parent directory of the ones above if program was installed with relativ pahts … … 242 219 boost::filesystem::path executablePath_; //!< Path to the executable 243 220 boost::filesystem::path mediaPath_; //!< Path to the media file folder 221 boost::filesystem::path externalMediaPath_; //!< Path to the media file folder 244 222 boost::filesystem::path configPath_; //!< Path to the config file folder 245 223 boost::filesystem::path logPath_; //!< Path to the log file folder … … 311 289 312 290 // initialise Tcl 313 this->tclBind_.reset(new TclBind(Core::get MediaPathString()));291 this->tclBind_.reset(new TclBind(Core::getExternalMediaPathString())); 314 292 this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter())); 315 293 … … 427 405 } 428 406 429 /*static*/ void Core::tset MediaPath(const std::string& path)430 { 431 getInstance().configuration_->tset MediaPath(path);407 /*static*/ void Core::tsetExternalMediaPath(const std::string& path) 408 { 409 getInstance().configuration_->tsetExternalMediaPath(path); 432 410 } 433 411 … … 439 417 { 440 418 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() + '/'; 441 428 } 442 429 … … 578 565 COUT(1) << "Running from the build tree." << std::endl; 579 566 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; 583 571 } 584 572 else … … 586 574 #ifdef INSTALL_COPYABLE // --> relative paths 587 575 // Also set the root path 588 boost::filesystem::path relativeExecutablePath( ORXONOX_RUNTIME_INSTALL_PATH);576 boost::filesystem::path relativeExecutablePath(specialConfig::defaultRuntimePath); 589 577 configuration_->rootPath_ = configuration_->executablePath_; 590 578 while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_) … … 595 583 596 584 // 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; 600 588 #else 601 589 // There is no root path, so don't set it at all 602 590 603 configuration_->mediaPath_ = ORXONOX_MEDIA_INSTALL_PATH;591 configuration_->mediaPath_ = specialConfig::mediaInstallDirectory; 604 592 605 593 // Get user directory … … 614 602 userDataPath /= ".orxonox"; 615 603 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; 618 606 #endif 619 607 } -
code/branches/resource3/src/core/Core.h
r5677 r5679 89 89 static void resetLanguage(); 90 90 91 static void tset MediaPath(const std::string& path);92 //! Returns the path to the configfiles as boost::filesystem::path91 static void tsetExternalMediaPath(const std::string& path); 92 //! Returns the path to the data files as boost::filesystem::path 93 93 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(); 94 96 //! Returns the path to the config files as boost::filesystem::path 95 97 static const boost::filesystem::path& getConfigPath(); 96 98 //! Returns the path to the log files as boost::filesystem::path 97 99 static const boost::filesystem::path& getLogPath(); 100 //! Returns the path to the data files as std::string 98 101 //! Returns the path to the root folder as boost::filesystem::path 99 102 static const boost::filesystem::path& getRootPath(); 100 //! Returns the path to the data files as std::string101 103 static std::string getMediaPathString(); 104 //! Returns the path to the external data files as std::string 105 static std::string getExternalMediaPathString(); 102 106 //! Returns the path to the config files as std::string 103 107 static std::string getConfigPathString(); -
code/branches/resource3/src/core/GUIManager.cc
r3370 r5679 171 171 { 172 172 // set datapath for GUI data 173 lua_pushfstring(this->scriptModule_->getLuaState(), Core::get MediaPathString().c_str());173 lua_pushfstring(this->scriptModule_->getLuaState(), Core::getExternalMediaPathString().c_str()); 174 174 lua_setglobal(this->scriptModule_->getLuaState(), "datapath"); 175 175 // call main Lua script -
code/branches/resource3/src/core/GraphicsManager.cc
r5677 r5679 117 117 SetConfigValue(ogreConfigFile_, "ogre.cfg") 118 118 .description("Location of the Ogre config file"); 119 SetConfigValue(ogrePlugins Folder_, ORXONOX_OGRE_PLUGINS_FOLDER)119 SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory) 120 120 .description("Folder where the Ogre plugins are located."); 121 SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)121 SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins) 122 122 .description("Comma separated list of all plugins to load."); 123 123 SetConfigValue(ogreLogFile_, "ogre.log") … … 204 204 { 205 205 // just to make sure the next statement doesn't segfault 206 if (ogrePlugins Folder_ == "")207 ogrePlugins Folder_ = ".";208 209 boost::filesystem::path folder(ogrePlugins Folder_);206 if (ogrePluginsDirectory_ == "") 207 ogrePluginsDirectory_ = "."; 208 209 boost::filesystem::path folder(ogrePluginsDirectory_); 210 210 // Do some SubString magic to get the comma separated list of plugins 211 211 SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '(', ')', false, '\0'); … … 231 231 try 232 232 { 233 cf.load((Core::get MediaPath() / resourceFile_).string());233 cf.load((Core::getExternalMediaPath() / resourceFile_).string()); 234 234 } 235 235 catch (...) … … 257 257 258 258 Ogre::ResourceGroupManager::getSingleton().addResourceLocation( 259 (Core::get MediaPath() / archName).string(), typeName, secName);259 (Core::getExternalMediaPath() / archName).string(), typeName, secName); 260 260 } 261 261 } -
code/branches/resource3/src/core/GraphicsManager.h
r5677 r5679 101 101 std::string resourceFile_; //!< resources file name 102 102 std::string ogreConfigFile_; //!< ogre config file name 103 std::string ogrePlugins Folder_; //!< Folderwhere the Ogre plugins are located103 std::string ogrePluginsDirectory_; //!< Directory where the Ogre plugins are located 104 104 std::string ogrePlugins_; //!< Comma separated list of all plugins to load 105 105 std::string ogreLogFile_; //!< log file name for Ogre log messages -
code/branches/resource3/src/core/LuaBind.cc
r3370 r5679 47 47 LuaBind::LuaBind() 48 48 { 49 this->includePath_ = Core::get MediaPathString();49 this->includePath_ = Core::getExternalMediaPathString(); 50 50 51 51 luaState_ = lua_open(); -
code/branches/resource3/src/core/TclBind.cc
r3370 r5679 127 127 #ifdef DEPENDENCY_PACKAGE_ENABLE 128 128 if (Core::isDevelopmentRun()) 129 return (std::string( ORXONOX_DEP_LIB_PATH) + "/tcl");129 return (std::string(specialConfig::dependencyLibraryDirectory) + "/tcl"); 130 130 else 131 131 return (Core::getRootPathString() + "lib/tcl"); -
code/branches/resource3/src/orxonox/LevelManager.cc
r3370 r5679 135 135 availableLevels_.clear(); 136 136 137 boost::filesystem::directory_iterator file(Core::get MediaPathString() + "levels");137 boost::filesystem::directory_iterator file(Core::getExternalMediaPathString() + "levels"); 138 138 boost::filesystem::directory_iterator end; 139 139 -
code/branches/resource3/src/orxonox/gamestates/GSGraphics.cc
r3370 r5679 96 96 // load debug overlay 97 97 COUT(3) << "Loading Debug Overlay..." << std::endl; 98 this->debugOverlay_ = new XMLFile(Core::get MediaPathString() + "overlay/debug.oxo");98 this->debugOverlay_ = new XMLFile(Core::getExternalMediaPathString() + "overlay/debug.oxo"); 99 99 Loader::open(debugOverlay_); 100 100 -
code/branches/resource3/src/orxonox/gamestates/GSLevel.cc
r5677 r5679 246 246 // call the loader 247 247 COUT(0) << "Loading level..." << std::endl; 248 startFile_s = new XMLFile(Core::get MediaPathString() + "levels" + '/' + LevelManager::getInstance().getDefaultLevel());248 startFile_s = new XMLFile(Core::getExternalMediaPathString() + "levels" + '/' + LevelManager::getInstance().getDefaultLevel()); 249 249 Loader::open(startFile_s); 250 250 } -
code/branches/resource3/src/orxonox/objects/Level.cc
r3325 r5679 54 54 this->xmlfilename_ = this->getFilename(); 55 55 56 if (this->xmlfilename_.length() >= Core::get MediaPathString().length())57 this->xmlfilename_ = this->xmlfilename_.substr(Core::get MediaPathString().length());56 if (this->xmlfilename_.length() >= Core::getExternalMediaPathString().length()) 57 this->xmlfilename_ = this->xmlfilename_.substr(Core::getExternalMediaPathString().length()); 58 58 } 59 59 … … 101 101 mask.include(Class(OverlayGroup)); // HACK to include the ChatOverlay 102 102 103 this->xmlfile_ = new XMLFile(Core::get MediaPathString() + this->xmlfilename_, mask);103 this->xmlfile_ = new XMLFile(Core::getExternalMediaPathString() + this->xmlfilename_, mask); 104 104 105 105 Loader::open(this->xmlfile_); -
code/branches/resource3/src/orxonox/orxonox.vcproj.user.in
r3196 r5679 11 11 <DebugSettings 12 12 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 13 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"13 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 14 14 EnvironmentMerge="true" 15 15 /> … … 20 20 <DebugSettings 21 21 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 22 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"22 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 23 23 EnvironmentMerge="true" 24 24 /> … … 29 29 <DebugSettings 30 30 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 31 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"31 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 32 32 EnvironmentMerge="true" 33 33 /> … … 38 38 <DebugSettings 39 39 WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)" 40 Environment="Path=${ ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"40 Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}" 41 41 EnvironmentMerge="true" 42 42 /> -
code/branches/resource3/src/orxonox/sound/SoundBase.cc
r3370 r5679 135 135 136 136 bool SoundBase::loadFile(std::string filename) { 137 filename = Core::get MediaPathString() + "/audio/" + filename;137 filename = Core::getExternalMediaPathString() + "/audio/" + filename; 138 138 139 139 if(!SoundManager::getInstance().isSoundAvailable())
Note: See TracChangeset
for help on using the changeset viewer.