1
0
forked from 0ad/0ad

Adds support for Boost.Filesystem v3, the only option in Boost 1.50. Fixes #1527. Refs #1360

This was SVN commit r12229.
This commit is contained in:
historic_bruno 2012-07-29 23:04:22 +00:00
parent 0f5756f5fb
commit 2c8adb1aea
6 changed files with 31 additions and 9 deletions

View File

@ -214,11 +214,12 @@ extern_lib_defs = {
if os.getversion().description == "OpenBSD" then
includedirs { "/usr/local/include" }
end
-- These are only needed for boost <= 1.43
add_default_links({
android_names = { "boost_system-gcc-mt" },
unix_names = { "boost_system-mt" },
bsd_names = { "boost_system" },
-- The following are not strictly link dependencies on all systems, but
-- are included for compatibility with different versions of Boost
android_names = { "boost_filesystem-gcc-mt", "boost_system-gcc-mt" },
unix_names = { "boost_filesystem-mt", "boost_system-mt" },
bsd_names = { "boost_filesystem", "boost_system" },
})
end,
link_settings = function()

View File

@ -425,9 +425,9 @@ public:
CTextureConverter::SettingsFile* f = GetSettingsFile(settingsPath);
if (f)
files.push_back(f);
p = p / *it;
p = p / GetWstringFromWpath(*it);
}
return m_TextureConverter.ComputeSettings(srcPath.leaf(), files);
return m_TextureConverter.ComputeSettings(GetWstringFromWpath(srcPath.leaf()), files);
}
/**

View File

@ -25,9 +25,16 @@
// the following boost libraries have been included in TR1 and are
// thus deemed usable:
#if BOOST_VERSION >= 104400
// Filesystem v3 is included since Boost 1.44
// v2 is deprecated since 1.46 and removed entirely in 1.50
# define BOOST_FILESYSTEM_VERSION 3
#else
# define BOOST_FILESYSTEM_VERSION 2
#endif
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#include <boost/shared_ptr.hpp>
// (these ones are used more rarely, so we don't enable them in minimal configurations)

View File

@ -95,6 +95,15 @@ Status ReloadChangedFiles()
return INFO::OK;
}
std::wstring GetWstringFromWpath(const fs::wpath& path)
{
#if BOOST_FILESYSTEM_VERSION == 3
return path.wstring();
#else
return path.string();
#endif
}
CVFSFile::CVFSFile()
: m_BufferSize(0)

View File

@ -54,6 +54,11 @@ void UnregisterFileReloadFunc(FileReloadFunc func, void* obj);
**/
extern Status ReloadChangedFiles();
/**
* Helper function to handle API differences between Boost Filesystem v2 and v3
*/
std::wstring GetWstringFromWpath(const fs::wpath& path);
ERROR_GROUP(CVFSFile);
ERROR_TYPE(CVFSFile, LoadFailed);
ERROR_TYPE(CVFSFile, AlreadyLoaded);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2012 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -53,7 +53,7 @@ public:
fs::wpath components = pathname.string();
fs::wpath::iterator it = components.begin();
std::advance(it, 2);
std::wstring dirname = *it;
std::wstring dirname = GetWstringFromWpath(*it);
CScriptValRooted ai;
self->m_ScriptInterface.Eval("({})", ai);