Changeset 8285 for code/branches/kicklib2/src/libraries/core
- Timestamp:
- Apr 21, 2011, 7:43:10 PM (14 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
-
code/branches/kicklib2/src/libraries/core/CorePrereqs.h
r8284 r8285 262 262 namespace boost 263 263 { 264 #if BOOST_VERSION < 104400 264 #if (BOOST_VERSION < 104400) 265 265 266 namespace filesystem 266 267 { … … 269 270 typedef basic_path<std::string, path_traits> path; 270 271 } 271 #elif BOOST_VERSION < 104600 272 273 #elif (BOOST_VERSION < 104800) 274 275 # if BOOST_FILESYSTEM_VERSION == 2 272 276 namespace filesystem2 273 277 { … … 282 286 using filesystem2::path; 283 287 } 288 # elif BOOST_FILESYSTEM_VERSION == 3 289 namespace filesystem3 290 { 291 class path; 292 } 293 namespace filesystem 294 { 295 using filesystem3::path; 296 } 297 # endif 298 284 299 #else 285 namespace filesystem3 300 301 // TODO: Check this once boost 1.48 is released 302 namespace filesystem 286 303 { 287 304 class path; 288 305 } 289 namespace filesystem 290 { 291 using filesystem3::path; 292 } 306 293 307 #endif 308 294 309 class thread; 295 310 class mutex; -
code/branches/kicklib2/src/libraries/core/GraphicsManager.cc
r8284 r8285 30 30 #include "GraphicsManager.h" 31 31 32 #include <cstdlib> 32 33 #include <fstream> 33 34 #include <sstream> … … 120 121 // Only for development runs 121 122 if (PathConfig::isDevelopmentRun()) 122 {123 123 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getExternalDataPathString(), "FileSystem"); 124 extResources_.reset(new XMLFile("resources.oxr")); 125 extResources_->setLuaSupport(false);126 Loader::open(extResources_.get());127 }124 125 extResources_.reset(new XMLFile("resources.oxr")); 126 extResources_->setLuaSupport(false); 127 Loader::open(extResources_.get()); 128 128 129 129 if (bLoadRenderer) … … 150 150 // Undeclare the resources 151 151 Loader::unload(resources_.get()); 152 if (PathConfig::isDevelopmentRun()) 153 Loader::unload(extResources_.get()); 152 Loader::unload(extResources_.get()); 154 153 } 155 154 … … 158 157 SetConfigValue(ogreConfigFile_, "ogre.cfg") 159 158 .description("Location of the Ogre config file"); 160 SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)161 .description("Folder where the Ogre plugins are located.");162 159 SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins) 163 160 .description("Comma separated list of all plugins to load."); … … 251 248 void GraphicsManager::loadOgrePlugins() 252 249 { 253 // just to make sure the next statement doesn't segfault 254 if (ogrePluginsDirectory_.empty()) 255 ogrePluginsDirectory_ = '.'; 256 257 boost::filesystem::path folder(ogrePluginsDirectory_); 250 // Plugin path can have many different locations... 251 std::string pluginPath = specialConfig::ogrePluginsDirectory; 252 #ifdef DEPENDENCY_PACKAGE_ENABLE 253 if (!PathConfig::isDevelopmentRun()) 254 { 255 # if defined(ORXONOX_PLATFORM_WINDOWS) 256 pluginPath = PathConfig::getExecutablePathString(); 257 # elif defined(ORXONOX_PLATFORM_APPLE) 258 // TODO: Where are the plugins being installed to? 259 pluginPath = PathConfig::getExecutablePathString(); 260 # endif 261 } 262 #endif 263 264 #ifdef ORXONOX_PLATFORM_WINDOWS 265 // Add OGRE plugin path to the environment. That way one plugin could 266 // also depend on another without problems on Windows 267 const char* currentPATH = getenv("PATH"); 268 std::string newPATH = pluginPath; 269 if (currentPATH != NULL) 270 newPATH = std::string(currentPATH) + ';' + newPATH; 271 putenv(const_cast<char*>(("PATH=" + newPATH).c_str())); 272 #endif 273 258 274 // Do some SubString magic to get the comma separated list of plugins 259 275 SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0'); 260 // Use backslash paths on Windows! file_string() already does that though.261 276 for (unsigned int i = 0; i < plugins.size(); ++i) 262 #if BOOST_FILESYSTEM_VERSION < 3 263 ogreRoot_->loadPlugin((folder / plugins[i]).file_string()); 264 #else 265 ogreRoot_->loadPlugin((folder / plugins[i]).string()); 266 #endif 277 ogreRoot_->loadPlugin(pluginPath + '/' + plugins[i]); 267 278 } 268 279 … … 290 301 291 302 Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_.get()); 292 293 // HACK294 #ifdef ORXONOX_PLATFORM_APPLE295 //INFO: This will give our window focus, and not lock it to the terminal296 ProcessSerialNumber psn = {0, kCurrentProcess};297 TransformProcessType(&psn, kProcessTransformToForegroundApplication);298 SetFrontProcess(&psn);299 #endif300 // End of HACK301 303 302 304 // create a full screen default viewport -
code/branches/kicklib2/src/libraries/core/GraphicsManager.h
r8283 r8285 128 128 // config values 129 129 std::string ogreConfigFile_; //!< ogre config filename 130 std::string ogrePluginsDirectory_; //!< Directory where the Ogre plugins are located131 130 std::string ogrePlugins_; //!< Comma separated list of all plugins to load 132 131 std::string ogreLogFile_; //!< log filename for Ogre log messages -
code/branches/kicklib2/src/libraries/core/Identifier.h
r8284 r8285 395 395 { 396 396 // Get the name of the class 397 const std::string&name = typeid(T).name();397 std::string name = typeid(T).name(); 398 398 399 399 // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used. -
code/branches/kicklib2/src/libraries/core/PathConfig.cc
r8284 r8285 33 33 #include <cstdio> 34 34 #include <vector> 35 #include <boost/version.hpp>36 35 #include <boost/filesystem.hpp> 37 36 … … 56 55 #include "CommandLineParser.h" 57 56 58 // Boost 1.36 has some issues with deprecated functions that have been omitted59 #if (BOOST_ VERSION == 103600)60 # define B OOST_LEAF_FUNCTION filename61 # elif (BOOST_FILESYSTEM_VERSION < 3)62 # define B OOST_LEAF_FUNCTION leaf57 // Differentiate Boost Filesystem v2 and v3 58 #if (BOOST_FILESYSTEM_VERSION < 3) 59 # define BF_LEAF leaf 60 # define BF_GENERIC_STRING string 61 # define BF_NATIVE_STRING file_string 63 62 #else 64 # define BOOST_LEAF_FUNCTION path().filename().string 63 # define BF_LEAF path().filename().string 64 # define BF_GENERIC_STRING generic_string 65 # define BF_NATIVE_STRING string 65 66 #endif 66 67 … … 242 243 { 243 244 ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \ 244 Please remove " + it->first. string());245 Please remove " + it->first.BF_GENERIC_STRING()); 245 246 } 246 247 if (bf::create_directories(it->first)) // function may not return true at all (bug?) … … 259 260 size_t moduleextensionlength = moduleextension.size(); 260 261 262 #ifdef ORXONOX_PLATFORM_WINDOWS 261 263 // Add that path to the PATH variable in case a module depends on another one 262 std::string pathVariable(getenv("PATH")); 263 putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str())); 264 const char* currentPATH = getenv("PATH"); 265 std::string newPATH = modulePath_.BF_NATIVE_STRING(); 266 if (currentPATH != NULL) 267 newPATH = std::string(currentPATH) + ';' + newPATH; 268 putenv(const_cast<char*>(("PATH=" + newPATH).c_str())); 269 #endif 264 270 265 271 // Make sure the path exists, otherwise don't load modules … … 273 279 while (file != end) 274 280 { 275 std::string filename = file->B OOST_LEAF_FUNCTION();281 std::string filename = file->BF_LEAF(); 276 282 277 283 // Check if the file ends with the extension in question … … 282 288 // We've found a helper file 283 289 const std::string& library = filename.substr(0, filename.size() - moduleextensionlength); 284 #if BOOST_FILESYSTEM_VERSION < 3 285 modulePaths.push_back((modulePath_ / library).file_string()); 286 #else 287 modulePaths.push_back((modulePath_ / library).string()); 288 #endif 290 modulePaths.push_back(getModulePathString() + library); 289 291 } 290 292 } … … 297 299 /*static*/ std::string PathConfig::getRootPathString() 298 300 { 299 return getInstance().rootPath_. string() + '/';301 return getInstance().rootPath_.BF_GENERIC_STRING() + '/'; 300 302 } 301 303 302 304 /*static*/ std::string PathConfig::getExecutablePathString() 303 305 { 304 return getInstance().executablePath_. string() + '/';306 return getInstance().executablePath_.BF_GENERIC_STRING() + '/'; 305 307 } 306 308 307 309 /*static*/ std::string PathConfig::getDataPathString() 308 310 { 309 return getInstance().dataPath_. string() + '/';311 return getInstance().dataPath_.BF_GENERIC_STRING() + '/'; 310 312 } 311 313 312 314 /*static*/ std::string PathConfig::getExternalDataPathString() 313 315 { 314 return getInstance().externalDataPath_. string() + '/';316 return getInstance().externalDataPath_.BF_GENERIC_STRING() + '/'; 315 317 } 316 318 317 319 /*static*/ std::string PathConfig::getConfigPathString() 318 320 { 319 return getInstance().configPath_. string() + '/';321 return getInstance().configPath_.BF_GENERIC_STRING() + '/'; 320 322 } 321 323 322 324 /*static*/ std::string PathConfig::getLogPathString() 323 325 { 324 return getInstance().logPath_. string() + '/';326 return getInstance().logPath_.BF_GENERIC_STRING() + '/'; 325 327 } 326 328 327 329 /*static*/ std::string PathConfig::getModulePathString() 328 330 { 329 return getInstance().modulePath_. string() + '/';331 return getInstance().modulePath_.BF_GENERIC_STRING() + '/'; 330 332 } 331 333 } -
code/branches/kicklib2/src/libraries/core/PathConfig.h
r7427 r8285 113 113 static std::string getModulePathString(); 114 114 115 //! Return tr rue for runs in the build directory (not installed)115 //! Return true for runs in the build directory (not installed) 116 116 static bool isDevelopmentRun() { return getInstance().bDevRun_; } 117 117 -
code/branches/kicklib2/src/libraries/core/Resource.cc
r8284 r8285 33 33 #include <OgreFileSystem.h> 34 34 #include <OgreResourceGroupManager.h> 35 36 // Differentiate Boost Filesystem v2 and v3 37 #if (BOOST_FILESYSTEM_VERSION < 3) 38 # define BF_GENERIC_STRING string 39 #else 40 # define BF_GENERIC_STRING generic_string 41 #endif 35 42 36 43 namespace orxonox … … 98 105 boost::filesystem::path base(it->archive->getName()); 99 106 base /= it->filename; 100 ptr->fileSystemPath = base. string();107 ptr->fileSystemPath = base.BF_GENERIC_STRING(); 101 108 } 102 109 return ptr; -
code/branches/kicklib2/src/libraries/core/command/ArgumentCompletionFunctions.cc
r8284 r8285 35 35 36 36 #include <map> 37 #include <boost/version.hpp>38 37 #include <boost/filesystem.hpp> 39 38 … … 47 46 #include "TclThreadManager.h" 48 47 49 // Boost 1.36 has some issues with deprecated functions that have been omitted 50 #if (BOOST_VERSION == 103600) 51 # define BOOST_LEAF_FUNCTION filename 52 # define BOOST_DICTIONARY_ENTRY_NAME string 53 #elif (BOOST_FILESYSTEM_VERSION < 3) 54 # define BOOST_LEAF_FUNCTION leaf 55 # define BOOST_DICTIONARY_ENTRY_NAME string 48 // Differentiate Boost Filesystem v2 and v3 49 #if (BOOST_FILESYSTEM_VERSION < 3) 50 # define BF_LEAF leaf 51 # define BF_GENERIC_STRING string 52 # define BF_DICTIONARY_ENTRY_NAME string 56 53 #else 57 # define BOOST_LEAF_FUNCTION path().filename().string 58 # define BOOST_DICTIONARY_ENTRY_NAME path().string 54 # define BF_LEAF path().filename().string 55 # define BF_GENERIC_STRING generic_string 56 # define BF_DICTIONARY_ENTRY_NAME path().string 59 57 #endif 60 58 … … 250 248 else 251 249 { 252 const std::string& dir = startdirectory. string();250 const std::string& dir = startdirectory.BF_GENERIC_STRING(); 253 251 if (dir.size() > 0 && dir[dir.size() - 1] == ':') 254 252 startdirectory = dir + '/'; … … 262 260 { 263 261 if (boost::filesystem::is_directory(*file)) 264 dirlist.push_back(ArgumentCompletionListElement(file->B OOST_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BOOST_DICTIONARY_ENTRY_NAME()) + '/', file->BOOST_LEAF_FUNCTION() + '/'));262 dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/')); 265 263 else 266 filelist.push_back(ArgumentCompletionListElement(file->B OOST_DICTIONARY_ENTRY_NAME(), getLowercase(file->BOOST_DICTIONARY_ENTRY_NAME()), file->BOOST_LEAF_FUNCTION()));264 filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF())); 267 265 ++file; 268 266 }
Note: See TracChangeset
for help on using the changeset viewer.