Changeset 8285 for code/branches/kicklib2/src/libraries/core/PathConfig.cc
- Timestamp:
- Apr 21, 2011, 7:43:10 PM (13 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.