Changeset 10547 for code/branches/core7/src
- Timestamp:
- Aug 23, 2015, 11:57:53 AM (9 years ago)
- Location:
- code/branches/core7/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/CMakeLists.txt
r10268 r10547 39 39 ADD_SUBDIRECTORY(orxonox) 40 40 SET(ORXONOX_MODULES CACHE INTERNAL "") 41 SET(ORXONOX_PLUGINS CACHE INTERNAL "") 41 42 ADD_SUBDIRECTORY(modules) 42 43 … … 72 73 OUTPUT_NAME orxonox 73 74 ) 74 # Main executable should depend on all modules 75 # Main executable should depend on all modules (but not on plugins) 75 76 ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES}) 76 77 -
code/branches/core7/src/SpecialConfig.h.in
r8351 r10547 60 60 const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@"; 61 61 const char defaultModulePath[] = "@DEFAULT_MODULE_PATH@"; 62 const char defaultPluginPath[] = "@DEFAULT_PLUGIN_PATH@"; 62 63 const char defaultDocPath[] = "@DEFAULT_DOC_PATH@"; 63 64 const char defaultDataPath[] = "@DEFAULT_DATA_PATH@"; … … 69 70 const char dataInstallDirectory[] = "@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIRECTORY@"; 70 71 const char moduleInstallDirectory[] = "@CMAKE_INSTALL_PREFIX@/@MODULE_INSTALL_DIRECTORY@"; 72 const char pluginInstallDirectory[] = "@CMAKE_INSTALL_PREFIX@/@PLUGIN_INSTALL_DIRECTORY@"; 71 73 #endif 72 74 … … 76 78 #ifdef CMAKE_CONFIGURATION_TYPES 77 79 const char moduleDevDirectory[] = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" CMAKE_INTDIR; 80 const char pluginDevDirectory[] = "@CMAKE_PLUGIN_OUTPUT_DIRECTORY@/" CMAKE_INTDIR; 78 81 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR; 79 82 const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR; 80 83 #else 81 84 const char moduleDevDirectory[] = "@CMAKE_MODULE_OUTPUT_DIRECTORY@"; 85 const char pluginDevDirectory[] = "@CMAKE_PLUGIN_OUTPUT_DIRECTORY@"; 82 86 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@"; 83 87 const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@"; … … 88 92 #endif 89 93 90 // Module extension94 // Module and plugin extension 91 95 const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@"; 96 const char pluginExtension[] = "@ORXONOX_PLUGIN_EXTENSION@"; 92 97 93 98 // OGRE PLUGINS -
code/branches/core7/src/libraries/core/ApplicationPaths.cc
r10509 r10547 74 74 , executablePath_(*(new bf::path())) 75 75 , modulePath_(*(new bf::path())) 76 , pluginPath_(*(new bf::path())) 76 77 , bBuildDirectoryRun_(false) 77 78 { … … 121 122 executablePath_ = bf::path(buffer).branch_path(); 122 123 123 ///////////////////// 124 // SET MODULE PATH//125 ///////////////////// 124 ///////////////////////////////// 125 // SET MODULE AND PLUGIN PATHS // 126 ///////////////////////////////// 126 127 127 128 if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me")) … … 130 131 ApplicationPaths::bBuildDirectoryRun_ = true; 131 132 modulePath_ = specialConfig::moduleDevDirectory; 133 pluginPath_ = specialConfig::pluginDevDirectory; 132 134 } 133 135 else … … 144 146 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?"); 145 147 146 // Module path isfixed as well148 // Module and plugin paths are fixed as well 147 149 modulePath_ = rootPath_ / specialConfig::defaultModulePath; 150 pluginPath_ = rootPath_ / specialConfig::defaultPluginPath; 148 151 149 152 #else 150 153 151 154 // There is no root path, so don't set it at all 152 // Module path isfixed as well155 // Module and plugin paths are fixed as well 153 156 modulePath_ = specialConfig::moduleInstallDirectory; 157 pluginPath_ = specialConfig::pluginInstallDirectory; 154 158 155 159 #endif … … 162 166 delete &executablePath_; 163 167 delete &modulePath_; 168 delete &pluginPath_; 164 169 } 165 170 166 171 std::vector<std::string> ApplicationPaths::getModulePaths() 167 172 { 168 std::vector<std::string> modulePaths; 173 return this->getModuleOrPluginPaths(modulePath_, specialConfig::moduleExtension); 174 } 175 176 std::vector<std::string> ApplicationPaths::getPluginPaths() 177 { 178 return this->getModuleOrPluginPaths(pluginPath_, specialConfig::pluginExtension); 179 } 180 181 std::vector<std::string> ApplicationPaths::getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension) 182 { 183 std::vector<std::string> paths; 169 184 170 185 // We search for helper files with the following extension 171 const std::string& moduleextension = specialConfig::moduleExtension; 172 size_t moduleextensionlength = moduleextension.size(); 173 174 // Make sure the path exists, otherwise don't load modules 175 if (!boost::filesystem::exists(modulePath_)) 176 return modulePaths; 177 178 boost::filesystem::directory_iterator file(modulePath_); 186 size_t extensionlength = extension.size(); 187 188 // Make sure the path exists, otherwise don't load modules/plugins 189 if (!boost::filesystem::exists(directory)) 190 return paths; 191 192 boost::filesystem::directory_iterator file(directory); 179 193 boost::filesystem::directory_iterator end; 180 194 … … 185 199 186 200 // Check if the file ends with the extension in question 187 if (filename.size() > moduleextensionlength)201 if (filename.size() > extensionlength) 188 202 { 189 if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)203 if (filename.substr(filename.size() - extensionlength) == extension) 190 204 { 191 205 // We've found a helper file 192 const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);193 modulePaths.push_back(getModulePathString()+ library);206 const std::string& library = filename.substr(0, filename.size() - extensionlength); 207 paths.push_back(directory.BF_GENERIC_STRING() + '/' + library); 194 208 } 195 209 } … … 197 211 } 198 212 199 return modulePaths;213 return paths; 200 214 } 201 215 … … 214 228 return getInstance().modulePath_.BF_GENERIC_STRING() + '/'; 215 229 } 230 231 /*static*/ std::string ApplicationPaths::getPluginPathString() 232 { 233 return getInstance().pluginPath_.BF_GENERIC_STRING() + '/'; 234 } 216 235 } -
code/branches/core7/src/libraries/core/ApplicationPaths.h
r10509 r10547 49 49 The ApplicationPaths class is a singleton which provides static paths of the application. 50 50 @details 51 The class provides information about the executable, root and module path.51 The class provides information about the executable, root and module/plugin path. 52 52 It determines those by the use of platform specific functions. 53 53 @remarks … … 63 63 /** 64 64 @brief 65 Retrieves the executable path and sets all hard coded fixed paths (currently only the module path)65 Retrieves the executable path and sets all hard coded fixed paths (currently only the module and the plugin paths) 66 66 Also checks for "orxonox_dev_build.keep_me" in the executable directory. 67 67 If found it means that this is not an installed run, hence we … … 82 82 static const boost::filesystem::path& getModulePath() 83 83 { return getInstance().modulePath_; } 84 //! Returns the path to the plugins as boost::filesystem::path 85 static const boost::filesystem::path& getPluginPath() 86 { return getInstance().pluginPath_; } 84 87 85 88 //! Returns the path to the root folder as std::string … … 89 92 //! Returns the path to the modules as std::string 90 93 static std::string getModulePathString(); 94 //! Returns the path to the plugins as std::string 95 static std::string getPluginPathString(); 91 96 92 97 //! Return true for runs in the build directory (not installed) … … 95 100 //! Returns a list with all modules declared by a *.module file in the module folder. 96 101 std::vector<std::string> getModulePaths(); 102 //! Returns a list with all plugins declared by a *.plugin file in the plugin folder. 103 std::vector<std::string> getPluginPaths(); 97 104 98 105 private: 99 106 ApplicationPaths(const ApplicationPaths&); //!< Don't use (undefined symbol) 107 108 std::vector<std::string> getModuleOrPluginPaths(boost::filesystem::path& directory, const std::string& extension); 100 109 101 110 //! Path to the parent directory of the ones above if program was installed with relative paths … … 103 112 boost::filesystem::path& executablePath_; //!< Path to the executable 104 113 boost::filesystem::path& modulePath_; //!< Path to the modules 114 boost::filesystem::path& pluginPath_; //!< Path to the plugins 105 115 106 116 bool bBuildDirectoryRun_; //!< True for runs in the build directory (not installed) -
code/branches/core7/src/libraries/core/Core.cc
r10544 r10547 142 142 orxout(internal_info) << "Executable path: " << ApplicationPaths::getExecutablePathString() << endl; 143 143 orxout(internal_info) << "Modules path: " << ApplicationPaths::getModulePathString() << endl; 144 orxout(internal_info) << "Plugins path: " << ApplicationPaths::getPluginPathString() << endl; 144 145 145 146 orxout(internal_info) << "Data path: " << ConfigurablePaths::getDataPathString() << endl;
Note: See TracChangeset
for help on using the changeset viewer.