Changeset 5645
- Timestamp:
- Aug 13, 2009, 10:50:07 PM (15 years ago)
- Location:
- code/branches/resource2
- Files:
-
- 15 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource2
- Property svn:externals
-
old new 1 media_stripped http://svn.orxonox.net/game/data/branches/media_stripped1 data_stripped https://svn.orxonox.net/game/data/branches/media_stripped
-
- Property svn:externals
-
code/branches/resource2/CMakeLists.txt
r5641 r5645 46 46 INCLUDE(BuildConfig) 47 47 48 # Configure media directory location and installation49 ADD_SUBDIRECTORY( media)48 # Configure data directory location and installation 49 ADD_SUBDIRECTORY(data) 50 50 51 51 # Create the actual project -
code/branches/resource2/cmake/BuildConfig.cmake
r5641 r5645 22 22 # Description: 23 23 # Configures the compilers and sets build options. 24 # This also includes handling the OGRE plugins and the media directory.24 # This also includes handling the OGRE plugins and the data directory. 25 25 # 26 26 … … 32 32 SET(DEFAULT_ARCHIVE_PATH lib/static) 33 33 SET(DEFAULT_DOC_PATH doc) 34 SET(DEFAULT_ MEDIA_PATH media)34 SET(DEFAULT_DATA_PATH data) 35 35 SET(DEFAULT_CONFIG_PATH config) 36 36 SET(DEFAULT_LOG_PATH log) … … 41 41 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH}) 42 42 SET(CMAKE_DOC_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH}) 43 # Media directories are only inputs43 # Data directories are only inputs 44 44 SET(CMAKE_CONFIG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH}) 45 45 SET(CMAKE_LOG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH}) … … 131 131 SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH}) 132 132 SET(DOC_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH}) 133 SET( MEDIA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MEDIA_PATH})133 SET(DATA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DATA_PATH}) 134 134 SET(CONFIG_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_CONFIG_PATH}) 135 135 SET(LOG_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LOG_PATH}) … … 142 142 SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static) 143 143 SET(DOC_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox) 144 SET( MEDIA_INSTALL_DIRECTORY${CMAKE_INSTALL_PREFIX}/share/orxonox)144 SET(DATA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/orxonox) 145 145 ENDIF() 146 146 -
code/branches/resource2/media/CMakeLists.txt
r5641 r5645 21 21 # Reto Grieder 22 22 # Description: 23 # Finds the external media directory and configures the media installation.24 # Default search paths are: ../../ media and ../media_extern23 # Finds the external data directory and configures the data installation. 24 # Default search paths are: ../../data and ../data_extern 25 25 # 26 26 27 # For dev runs we've got two media directory. The one from the other repository root folder28 # is called EXTERNAL_ MEDIA29 SET( MEDIA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})30 SET( MEDIA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)27 # For dev runs we've got two data directory. The one from the other repository root folder 28 # is called EXTERNAL_DATA 29 SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 30 SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE) 31 31 32 # Specify media directory33 GET_FILENAME_COMPONENT(_search_path_1 ${CMAKE_SOURCE_DIR}/../${DEFAULT_ MEDIA_PATH} ABSOLUTE)34 FIND_PATH(EXTERNAL_ MEDIA_DIRECTORY resources.oxr32 # Specify data directory 33 GET_FILENAME_COMPONENT(_search_path_1 ${CMAKE_SOURCE_DIR}/../${DEFAULT_DATA_PATH} ABSOLUTE) 34 FIND_PATH(EXTERNAL_DATA_DIRECTORY resources.oxr 35 35 PATHS 36 ${CMAKE_SOURCE_DIR}/ media_extern36 ${CMAKE_SOURCE_DIR}/data_extern 37 37 ${_search_path_1} 38 38 NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH 39 39 ) 40 40 41 IF(NOT EXTERNAL_ MEDIA_DIRECTORY)42 MESSAGE(STATUS "Warning: External media directory not found. If you want to compile while downloading the media files, you will have to recompile about four files afterwards and relink everything. \\n You can specify your own folder with the MEDIA_DIRECTORY variable. Default location for the path is orxonox_root/media_extern")41 IF(NOT EXTERNAL_DATA_DIRECTORY) 42 MESSAGE(STATUS "Warning: External data directory not found. If you want to compile while downloading the data files, you will have to recompile about four files afterwards and relink everything. \\n You can specify your own folder with the DATA_DIRECTORY variable. Default location for the path is orxonox_root/data_extern") 43 43 # Temporary override to the default location. 44 SET(EXTERNAL_ MEDIA_DIRECTORY ${CMAKE_SOURCE_DIR}/media_extern)44 SET(EXTERNAL_DATA_DIRECTORY ${CMAKE_SOURCE_DIR}/data_extern) 45 45 ENDIF() 46 46 … … 50 50 # Internal directory 51 51 INSTALL( 52 DIRECTORY ${ MEDIA_DIRECTORY}/53 DESTINATION ${ MEDIA_INSTALL_DIRECTORY}52 DIRECTORY ${DATA_DIRECTORY}/ 53 DESTINATION ${DATA_INSTALL_DIRECTORY} 54 54 REGEX "\\.svn$|_svn$|CMakeLists.txt|InstallScript.cmake" EXCLUDE 55 55 ) 56 56 # External directory 57 57 INSTALL( 58 DIRECTORY ${EXTERNAL_ MEDIA_DIRECTORY}/59 DESTINATION ${ MEDIA_INSTALL_DIRECTORY}58 DIRECTORY ${EXTERNAL_DATA_DIRECTORY}/ 59 DESTINATION ${DATA_INSTALL_DIRECTORY} 60 60 REGEX "\\.svn$|_svn$|resources\\.oxr" EXCLUDE 61 61 ) 62 62 # Configure the install scripts (variables not available during installation) 63 CONFIGURE_FILE( MediaInstallScript.cmake ${CMAKE_CURRENT_BINARY_DIR}/MediaInstallScript.cmake @ONLY)63 CONFIGURE_FILE(DataInstallScript.cmake ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake @ONLY) 64 64 # Join both resources.oxr files 65 INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/ MediaInstallScript.cmake)65 INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake) -
code/branches/resource2/media/DataInstallScript.cmake
r5644 r5645 29 29 30 30 # Write some comment 31 FILE(APPEND @ MEDIA_INSTALL_DIRECTORY@/resources.oxr "\n\n\n <!-- ----------------------------------------- -->")32 FILE(APPEND @ MEDIA_INSTALL_DIRECTORY@/resources.oxr "\n <!-- Content from the external media directory -->")33 FILE(APPEND @ MEDIA_INSTALL_DIRECTORY@/resources.oxr "\n <!-- ----------------------------------------- -->\n\n")31 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr "\n\n\n <!-- ---------------------------------------- -->") 32 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr "\n <!-- Content from the external data directory -->") 33 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr "\n <!-- ---------------------------------------- -->\n\n") 34 34 35 35 # Append the external file 36 FILE(READ @EXTERNAL_ MEDIA_DIRECTORY@/resources.oxr _external_file)37 FILE(APPEND @ MEDIA_INSTALL_DIRECTORY@/resources.oxr ${_external_file})36 FILE(READ @EXTERNAL_DATA_DIRECTORY@/resources.oxr _external_file) 37 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr ${_external_file}) -
code/branches/resource2/src/SpecialConfig.h.in
r5641 r5645 77 77 const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@"; 78 78 const char defaultDocPath[] = "@DEFAULT_DOC_PATH@"; 79 const char default MediaPath[] = "@DEFAULT_MEDIA_PATH@";79 const char defaultDataPath[] = "@DEFAULT_DATA_PATH@"; 80 80 const char defaultConfigPath[] = "@DEFAULT_CONFIG_PATH@"; 81 81 const char defaultLogPath[] = "@DEFAULT_LOG_PATH@"; 82 82 83 83 // INSTALLATION PATHS 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@"; 84 const char dataInstallDirectory[] = "@DATA_INSTALL_DIRECTORY@"; 88 85 89 86 // DEVELOPMENT RUN PATHS 90 const char mediaDevDirectory[] = "@MEDIA_DIRECTORY@";91 const char external MediaDevDirectory[] = "@EXTERNAL_MEDIA_DIRECTORY@";87 const char dataDevDirectory[] = "@DATA_DIRECTORY@"; 88 const char externalDataDevDirectory[] = "@EXTERNAL_DATA_DIRECTORY@"; 92 89 #ifdef CMAKE_CONFIGURATION_TYPES 93 90 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE); -
code/branches/resource2/src/core/ConfigFileManager.cc
r3370 r5645 229 229 if (!boost::filesystem::exists(filepath)) 230 230 { 231 // Try to get default one from the media folder232 boost::filesystem::path defaultFilepath(Core::get MediaPath() / "defaultConfig" / this->filename_);231 // Try to get default one from the data folder 232 boost::filesystem::path defaultFilepath(Core::getDataPath() / "defaultConfig" / this->filename_); 233 233 if (boost::filesystem::exists(defaultFilepath)) 234 234 { -
code/branches/resource2/src/core/Core.cc
r5641 r5645 85 85 Core* Core::singletonPtr_s = 0; 86 86 87 SetCommandLineArgument(external MediaPath, "").information("Path to the external media files");87 SetCommandLineArgument(externalDataPath, "").information("Path to the external data 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 // External media directory only exists for dev runs112 // External data directory only exists for dev runs 113 113 if (Core::isDevelopmentRun()) 114 114 { 115 // Possible media path override by the command line116 if (!CommandLine::getArgument("external MediaPath")->hasDefaultValue())117 tsetExternal MediaPath(CommandLine::getValue("externalMediaPath"));115 // Possible data path override by the command line 116 if (!CommandLine::getArgument("externalDataPath")->hasDefaultValue()) 117 tsetExternalDataPath(CommandLine::getValue("externalDataPath")); 118 118 } 119 119 } … … 188 188 /** 189 189 @brief 190 Temporary sets the media path190 Temporary sets the data path 191 191 @param path 192 The new media path192 The new data path 193 193 */ 194 void tsetExternal MediaPath(const std::string& path)195 { 196 mediaPath_ = boost::filesystem::path(path);194 void tsetExternalDataPath(const std::string& path) 195 { 196 dataPath_ = boost::filesystem::path(path); 197 197 } 198 198 … … 218 218 boost::filesystem::path rootPath_; 219 219 boost::filesystem::path executablePath_; //!< Path to the executable 220 boost::filesystem::path mediaPath_; //!< Path to the media file folder221 boost::filesystem::path external MediaPath_; //!< Path to the media file folder220 boost::filesystem::path dataPath_; //!< Path to the data file folder 221 boost::filesystem::path externalDataPath_; //!< Path to the external data file folder 222 222 boost::filesystem::path configPath_; //!< Path to the config file folder 223 223 boost::filesystem::path logPath_; //!< Path to the log file folder … … 283 283 284 284 // initialise Tcl 285 this->tclBind_.reset(new TclBind(Core::get MediaPathString()));285 this->tclBind_.reset(new TclBind(Core::getDataPathString())); 286 286 this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter())); 287 287 … … 401 401 } 402 402 403 /*static*/ void Core::tsetExternal MediaPath(const std::string& path)404 { 405 getInstance().configuration_->tsetExternal MediaPath(path);406 } 407 408 /*static*/ const boost::filesystem::path& Core::get MediaPath()409 { 410 return getInstance().configuration_-> mediaPath_;411 } 412 /*static*/ std::string Core::get MediaPathString()413 { 414 return getInstance().configuration_-> mediaPath_.string() + '/';415 } 416 417 /*static*/ const boost::filesystem::path& Core::getExternal MediaPath()418 { 419 return getInstance().configuration_->external MediaPath_;420 } 421 /*static*/ std::string Core::getExternal MediaPathString()422 { 423 return getInstance().configuration_->external MediaPath_.string() + '/';403 /*static*/ void Core::tsetExternalDataPath(const std::string& path) 404 { 405 getInstance().configuration_->tsetExternalDataPath(path); 406 } 407 408 /*static*/ const boost::filesystem::path& Core::getDataPath() 409 { 410 return getInstance().configuration_->dataPath_; 411 } 412 /*static*/ std::string Core::getDataPathString() 413 { 414 return getInstance().configuration_->dataPath_.string() + '/'; 415 } 416 417 /*static*/ const boost::filesystem::path& Core::getExternalDataPath() 418 { 419 return getInstance().configuration_->externalDataPath_; 420 } 421 /*static*/ std::string Core::getExternalDataPathString() 422 { 423 return getInstance().configuration_->externalDataPath_.string() + '/'; 424 424 } 425 425 … … 561 561 COUT(1) << "Running from the build tree." << std::endl; 562 562 Core::bDevRun_ = true; 563 configuration_-> mediaPath_ = specialConfig::mediaDevDirectory;564 configuration_->external MediaPath_ = specialConfig::externalMediaDevDirectory;563 configuration_->dataPath_ = specialConfig::dataDevDirectory; 564 configuration_->externalDataPath_ = specialConfig::externalDataDevDirectory; 565 565 configuration_->configPath_ = specialConfig::configDevDirectory; 566 566 configuration_->logPath_ = specialConfig::logDevDirectory; … … 579 579 580 580 // Using paths relative to the install prefix, complete them 581 configuration_-> mediaPath_ = configuration_->rootPath_ / specialConfig::defaultMediaPath;581 configuration_->dataPath_ = configuration_->rootPath_ / specialConfig::defaultDataPath; 582 582 configuration_->configPath_ = configuration_->rootPath_ / specialConfig::defaultConfigPath; 583 583 configuration_->logPath_ = configuration_->rootPath_ / specialConfig::defaultLogPath; … … 585 585 // There is no root path, so don't set it at all 586 586 587 configuration_-> mediaPath_ = specialConfig::mediaInstallDirectory;587 configuration_->dataPath_ = specialConfig::dataInstallDirectory; 588 588 589 589 // Get user directory -
code/branches/resource2/src/core/Core.h
r5641 r5645 57 57 The Core class is a singleton used to configure the program basics. 58 58 @details 59 The class provides information about the media, config and log path.59 The class provides information about the data, config and log path. 60 60 It determines those by the use of platform specific functions. 61 61 @remark … … 91 91 static void resetLanguage(); 92 92 93 static void tsetExternal MediaPath(const std::string& path);93 static void tsetExternalDataPath(const std::string& path); 94 94 //! Returns the path to the data files as boost::filesystem::path 95 static const boost::filesystem::path& get MediaPath();95 static const boost::filesystem::path& getDataPath(); 96 96 //! Returns the path to the external data files as boost::filesystem::path 97 static const boost::filesystem::path& getExternal MediaPath();97 static const boost::filesystem::path& getExternalDataPath(); 98 98 //! Returns the path to the config files as boost::filesystem::path 99 99 static const boost::filesystem::path& getConfigPath(); 100 100 //! Returns the path to the log files as boost::filesystem::path 101 101 static const boost::filesystem::path& getLogPath(); 102 //! Returns the path to the data files as std::string103 102 //! Returns the path to the root folder as boost::filesystem::path 104 103 static const boost::filesystem::path& getRootPath(); 105 static std::string getMediaPathString(); 104 //! Returns the path to the data files as std::string 105 static std::string getDataPathString(); 106 106 //! Returns the path to the external data files as std::string 107 static std::string getExternal MediaPathString();107 static std::string getExternalDataPathString(); 108 108 //! Returns the path to the config files as std::string 109 109 static std::string getConfigPathString(); -
code/branches/resource2/src/core/GUIManager.cc
r3370 r5645 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::getDataPathString().c_str()); 174 174 lua_setglobal(this->scriptModule_->getLuaState(), "datapath"); 175 175 // call main Lua script -
code/branches/resource2/src/core/LuaBind.cc
r3370 r5645 47 47 LuaBind::LuaBind() 48 48 { 49 this->includePath_ = Core::get MediaPathString();49 this->includePath_ = Core::getDataPathString(); 50 50 51 51 luaState_ = lua_open(); -
code/branches/resource2/src/orxonox/LevelManager.cc
r3370 r5645 135 135 availableLevels_.clear(); 136 136 137 boost::filesystem::directory_iterator file(Core::get MediaPathString() + "levels");137 boost::filesystem::directory_iterator file(Core::getDataPathString() + "levels"); 138 138 boost::filesystem::directory_iterator end; 139 139 -
code/branches/resource2/src/orxonox/gamestates/GSGraphics.cc
r3370 r5645 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::getDataPathString() + "overlay/debug.oxo"); 99 99 Loader::open(debugOverlay_); 100 100 -
code/branches/resource2/src/orxonox/gamestates/GSLevel.cc
r5614 r5645 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::getDataPathString() + "levels" + '/' + LevelManager::getInstance().getDefaultLevel()); 249 249 Loader::open(startFile_s); 250 250 } -
code/branches/resource2/src/orxonox/objects/Level.cc
r3325 r5645 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::getDataPathString().length()) 57 this->xmlfilename_ = this->xmlfilename_.substr(Core::getDataPathString().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::getDataPathString() + this->xmlfilename_, mask); 104 104 105 105 Loader::open(this->xmlfile_); -
code/branches/resource2/src/orxonox/sound/SoundBase.cc
r3370 r5645 135 135 136 136 bool SoundBase::loadFile(std::string filename) { 137 filename = Core::get MediaPathString() + "/audio/" + filename;137 filename = Core::getDataPathString() + "/audio/" + filename; 138 138 139 139 if(!SoundManager::getInstance().isSoundAvailable())
Note: See TracChangeset
for help on using the changeset viewer.