[Orxonox-commit 3539] r8225 - in code/branches/kicklib/src: . libraries/core libraries/core/command
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Apr 10 21:04:00 CEST 2011
Author: rgrieder
Date: 2011-04-10 21:03:59 +0200 (Sun, 10 Apr 2011)
New Revision: 8225
Modified:
code/branches/kicklib/src/OrxonoxConfig.h.in
code/branches/kicklib/src/libraries/core/CorePrereqs.h
code/branches/kicklib/src/libraries/core/GraphicsManager.cc
code/branches/kicklib/src/libraries/core/PathConfig.cc
code/branches/kicklib/src/libraries/core/Resource.cc
code/branches/kicklib/src/libraries/core/command/ArgumentCompletionFunctions.cc
Log:
Resolved problems with different Boost filesystem versions.
Modified: code/branches/kicklib/src/OrxonoxConfig.h.in
===================================================================
--- code/branches/kicklib/src/OrxonoxConfig.h.in 2011-04-10 19:02:15 UTC (rev 8224)
+++ code/branches/kicklib/src/OrxonoxConfig.h.in 2011-04-10 19:03:59 UTC (rev 8225)
@@ -227,4 +227,14 @@
using boost::scoped_array;
}
+// Define Boost Filesystem version
+#include <boost/version.hpp>
+#ifndef BOOST_FILESYSTEM_VERSION
+# if (BOOST_VERSION < 104600)
+# define BOOST_FILESYSTEM_VERSION 2
+# else
+# define BOOST_FILESYSTEM_VERSION 3
+# endif
+#endif
+
#endif /* _OrxonoxConfig_H__ */
Modified: code/branches/kicklib/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/kicklib/src/libraries/core/CorePrereqs.h 2011-04-10 19:02:15 UTC (rev 8224)
+++ code/branches/kicklib/src/libraries/core/CorePrereqs.h 2011-04-10 19:03:59 UTC (rev 8225)
@@ -260,14 +260,18 @@
// Boost
namespace boost
{
-#if BOOST_VERSION < 104400
+#if (BOOST_VERSION < 104400)
+
namespace filesystem
{
struct path_traits;
template <class String, class Traits> class basic_path;
typedef basic_path<std::string, path_traits> path;
}
-#elif BOOST_VERSION < 104600
+
+#elif (BOOST_VERSION < 104800)
+
+# if BOOST_FILESYSTEM_VERSION == 2
namespace filesystem2
{
struct path_traits;
@@ -280,7 +284,7 @@
using filesystem2::path_traits;
using filesystem2::path;
}
-#else
+# elif BOOST_FILESYSTEM_VERSION == 3
namespace filesystem3
{
class path;
@@ -289,7 +293,18 @@
{
using filesystem3::path;
}
+# endif
+
+#elif
+
+ // TODO: Check this once boost 1.48 is released
+ namespace filesystem
+ {
+ class path;
+ }
+
#endif
+
class thread;
class mutex;
class shared_mutex;
Modified: code/branches/kicklib/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/GraphicsManager.cc 2011-04-10 19:02:15 UTC (rev 8224)
+++ code/branches/kicklib/src/libraries/core/GraphicsManager.cc 2011-04-10 19:03:59 UTC (rev 8225)
@@ -60,6 +60,13 @@
#include "XMLFile.h"
#include "command/ConsoleCommand.h"
+// Differentiate Boost Filesystem v2 and v3
+#if (BOOST_FILESYSTEM_VERSION < 3)
+# define BF_NATIVE_STRING file_string
+#else
+# define BF_NATIVE_STRING string
+#endif
+
namespace orxonox
{
static const std::string __CC_printScreen_name = "printScreen";
@@ -242,11 +249,7 @@
SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0');
// Use backslash paths on Windows! file_string() already does that though.
for (unsigned int i = 0; i < plugins.size(); ++i)
-#if BOOST_FILESYSTEM_VERSION < 3
- ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
-#else
- ogreRoot_->loadPlugin((folder / plugins[i]).string());
-#endif
+ ogreRoot_->loadPlugin((folder / plugins[i]).BF_NATIVE_STRING());
}
void GraphicsManager::loadRenderer()
Modified: code/branches/kicklib/src/libraries/core/PathConfig.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/PathConfig.cc 2011-04-10 19:02:15 UTC (rev 8224)
+++ code/branches/kicklib/src/libraries/core/PathConfig.cc 2011-04-10 19:03:59 UTC (rev 8225)
@@ -32,7 +32,6 @@
#include <cstdlib>
#include <cstdio>
#include <vector>
-#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#ifdef ORXONOX_PLATFORM_WINDOWS
@@ -55,13 +54,15 @@
#include "util/Exception.h"
#include "CommandLineParser.h"
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-# define BOOST_LEAF_FUNCTION filename
-#elif (BOOST_FILESYSTEM_VERSION < 3)
-# define BOOST_LEAF_FUNCTION leaf
+// Differentiate Boost Filesystem v2 and v3
+#if (BOOST_FILESYSTEM_VERSION < 3)
+# define BF_LEAF leaf
+# define BF_GENERIC_STRING string
+# define BF_NATIVE_STRING file_string
#else
-# define BOOST_LEAF_FUNCTION path().filename().string
+# define BF_LEAF path().filename().string
+# define BF_GENERIC_STRING generic_string
+# define BF_NATIVE_STRING string
#endif
namespace orxonox
@@ -241,7 +242,7 @@
if (bf::exists(it->first) && !bf::is_directory(it->first))
{
ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
- Please remove " + it->first.string());
+ Please remove " + it->first.BF_GENERIC_STRING());
}
if (bf::create_directories(it->first)) // function may not return true at all (bug?)
{
@@ -260,7 +261,7 @@
// Add that path to the PATH variable in case a module depends on another one
std::string pathVariable(getenv("PATH"));
- putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
+ putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.BF_NATIVE_STRING()).c_str()));
// Make sure the path exists, otherwise don't load modules
if (!boost::filesystem::exists(modulePath_))
@@ -272,7 +273,7 @@
// Iterate through all files
while (file != end)
{
- std::string filename = file->BOOST_LEAF_FUNCTION();
+ std::string filename = file->BF_LEAF();
// Check if the file ends with the extension in question
if (filename.size() > moduleextensionlength)
@@ -281,11 +282,7 @@
{
// We've found a helper file
const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
-#if BOOST_FILESYSTEM_VERSION < 3
- modulePaths.push_back((modulePath_ / library).file_string());
-#else
- modulePaths.push_back((modulePath_ / library).string());
-#endif
+ modulePaths.push_back((modulePath_ / library).BF_NATIVE_STRING());
}
}
++file;
@@ -296,36 +293,36 @@
/*static*/ std::string PathConfig::getRootPathString()
{
- return getInstance().rootPath_.string() + '/';
+ return getInstance().rootPath_.BF_GENERIC_STRING() + '/';
}
/*static*/ std::string PathConfig::getExecutablePathString()
{
- return getInstance().executablePath_.string() + '/';
+ return getInstance().executablePath_.BF_GENERIC_STRING() + '/';
}
/*static*/ std::string PathConfig::getDataPathString()
{
- return getInstance().dataPath_.string() + '/';
+ return getInstance().dataPath_.BF_GENERIC_STRING() + '/';
}
/*static*/ std::string PathConfig::getExternalDataPathString()
{
- return getInstance().externalDataPath_.string() + '/';
+ return getInstance().externalDataPath_.BF_GENERIC_STRING() + '/';
}
/*static*/ std::string PathConfig::getConfigPathString()
{
- return getInstance().configPath_.string() + '/';
+ return getInstance().configPath_.BF_GENERIC_STRING() + '/';
}
/*static*/ std::string PathConfig::getLogPathString()
{
- return getInstance().logPath_.string() + '/';
+ return getInstance().logPath_.BF_GENERIC_STRING() + '/';
}
/*static*/ std::string PathConfig::getModulePathString()
{
- return getInstance().modulePath_.string() + '/';
+ return getInstance().modulePath_.BF_GENERIC_STRING() + '/';
}
}
Modified: code/branches/kicklib/src/libraries/core/Resource.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/Resource.cc 2011-04-10 19:02:15 UTC (rev 8224)
+++ code/branches/kicklib/src/libraries/core/Resource.cc 2011-04-10 19:03:59 UTC (rev 8225)
@@ -33,6 +33,13 @@
#include <OgreFileSystem.h>
#include <OgreResourceGroupManager.h>
+// Differentiate Boost Filesystem v2 and v3
+#if (BOOST_FILESYSTEM_VERSION < 3)
+# define BF_GENERIC_STRING string
+#else
+# define BF_GENERIC_STRING generic_string
+#endif
+
namespace orxonox
{
const std::string& Resource::getDefaultResourceGroup()
@@ -97,7 +104,7 @@
{
boost::filesystem::path base(it->archive->getName());
base /= it->filename;
- ptr->fileSystemPath = base.string();
+ ptr->fileSystemPath = base.BF_GENERIC_STRING();
}
return ptr;
}
Modified: code/branches/kicklib/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/command/ArgumentCompletionFunctions.cc 2011-04-10 19:02:15 UTC (rev 8224)
+++ code/branches/kicklib/src/libraries/core/command/ArgumentCompletionFunctions.cc 2011-04-10 19:03:59 UTC (rev 8225)
@@ -34,7 +34,6 @@
#include "ArgumentCompletionFunctions.h"
#include <map>
-#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include "util/Convert.h"
@@ -46,16 +45,15 @@
#include "ConsoleCommand.h"
#include "TclThreadManager.h"
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-# define BOOST_LEAF_FUNCTION filename
-# define BOOST_DICTIONARY_ENTRY_NAME string
-#elif (BOOST_FILESYSTEM_VERSION < 3)
-# define BOOST_LEAF_FUNCTION leaf
-# define BOOST_DICTIONARY_ENTRY_NAME string
+// Differentiate Boost Filesystem v2 and v3
+#if (BOOST_FILESYSTEM_VERSION < 3)
+# define BF_LEAF leaf
+# define BF_GENERIC_STRING string
+# define BF_DICTIONARY_ENTRY_NAME string
#else
-# define BOOST_LEAF_FUNCTION path().filename().string
-# define BOOST_DICTIONARY_ENTRY_NAME path().string
+# define BF_LEAF path().filename().string
+# define BF_GENERIC_STRING generic_string
+# define BF_DICTIONARY_ENTRY_NAME path().string
#endif
namespace orxonox
@@ -249,7 +247,7 @@
#ifdef ORXONOX_PLATFORM_WINDOWS
else
{
- const std::string& dir = startdirectory.string();
+ const std::string& dir = startdirectory.BF_GENERIC_STRING();
if (dir.size() > 0 && dir[dir.size() - 1] == ':')
startdirectory = dir + '/';
}
@@ -261,9 +259,9 @@
while (file != end)
{
if (boost::filesystem::is_directory(*file))
- dirlist.push_back(ArgumentCompletionListElement(file->BOOST_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BOOST_DICTIONARY_ENTRY_NAME()) + '/', file->BOOST_LEAF_FUNCTION() + '/'));
+ dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/'));
else
- filelist.push_back(ArgumentCompletionListElement(file->BOOST_DICTIONARY_ENTRY_NAME(), getLowercase(file->BOOST_DICTIONARY_ENTRY_NAME()), file->BOOST_LEAF_FUNCTION()));
+ filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF()));
++file;
}
}
More information about the Orxonox-commit
mailing list