From 6856199274e9c5e581220fccf520b8f011519d17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Fri, 17 Aug 2012 23:18:17 +0200
Subject: Update to boost.filesystem v3.

Source should still compile against v2.

diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript
index 714b90b..f0d438b 100644
--- a/3rdParty/Boost/SConscript
+++ b/3rdParty/Boost/SConscript
@@ -19,7 +19,7 @@ elif env.get("BOOST_BUNDLED", False) :
 # Common
 ################################################################################
 
-	cppdefines = ["BOOST_ALL_NO_LIB", "BOOST_SYSTEM_NO_DEPRECATED", ("BOOST_FILESYSTEM_VERSION", "2")]
+	cppdefines = ["BOOST_ALL_NO_LIB", "BOOST_SYSTEM_NO_DEPRECATED"]
 	#if env["PLATFORM"] == "darwin" :
 	#	cppdefines += ["BOOST_ASIO_DISABLE_KQUEUE"]
 	if env["PLATFORM"] == "win32" :
@@ -65,9 +65,16 @@ elif env.get("BOOST_BUNDLED", False) :
 				"src/libs/signals/src/signal_base.cpp",
 				"src/libs/signals/src/slot.cpp",
 				"src/libs/signals/src/trackable.cpp",
-				"src/libs/filesystem/v2/src/v2_operations.cpp",
-				"src/libs/filesystem/v2/src/v2_path.cpp",
-				"src/libs/filesystem/v2/src/v2_portability.cpp",
+				"src/libs/filesystem/v3/src/codecvt_error_category.cpp",
+				"src/libs/filesystem/v3/src/operations.cpp",
+				"src/libs/filesystem/v3/src/path.cpp",
+				"src/libs/filesystem/v3/src/path_traits.cpp",
+				"src/libs/filesystem/v3/src/portability.cpp",
+				"src/libs/filesystem/v3/src/unique_path.cpp",
+				"src/libs/filesystem/v3/src/windows_file_codecvt.cpp",
+#				"src/libs/filesystem/v2/src/v2_operations.cpp",
+#				"src/libs/filesystem/v2/src/v2_path.cpp",
+#				"src/libs/filesystem/v2/src/v2_portability.cpp",
 				"src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp",
 				"src/libs/regex/src/c_regex_traits.cpp",
 				"src/libs/regex/src/cpp_regex_traits.cpp",
@@ -122,13 +129,6 @@ elif env.get("BOOST_BUNDLED", False) :
 			bcp_env.Append(CPPPATH = ["src/tools/bcp"])
 			bcp_env.Replace(CPPDEFINES = [flag for flag in bcp_env["CPPDEFINES"] if flag[0] != "BOOST_FILESYSTEM_VERSION"])
 			bcp_env.Program("bcp", [
-					"src/libs/filesystem/v3/src/codecvt_error_category.cpp",
-					"src/libs/filesystem/v3/src/operations.cpp",
-					"src/libs/filesystem/v3/src/path.cpp",
-					"src/libs/filesystem/v3/src/path_traits.cpp",
-					"src/libs/filesystem/v3/src/portability.cpp",
-					"src/libs/filesystem/v3/src/unique_path.cpp",
-					"src/libs/filesystem/v3/src/windows_file_codecvt.cpp",
 					"src/tools/bcp/add_path.cpp",
 					"src/tools/bcp/add_dependent_lib.cpp",
 					"src/tools/bcp/bcp_imp.cpp",
diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp
index 853738c..7fd8b07 100644
--- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp
+++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp
@@ -103,7 +103,12 @@ boost::optional<JID> FileTransferManagerImpl::highestPriorityJIDSupportingFileTr
 }
 
 OutgoingFileTransfer::ref FileTransferManagerImpl::createOutgoingFileTransfer(const JID& to, const boost::filesystem::path& filepath, const std::string& description, boost::shared_ptr<ReadBytestream> bytestream) {
+#if BOOST_FILESYSTEM_VERSION == 2 // TODO: Delete this when boost 1.44 becomes a minimum requirement, and we no longer need v2
 	std::string filename = filepath.filename();
+#else
+	std::string filename = filepath.filename().string();
+#endif
+
 	boost::uintmax_t sizeInBytes = boost::filesystem::file_size(filepath);
 	boost::posix_time::ptime lastModified = boost::posix_time::from_time_t(boost::filesystem::last_write_time(filepath));
 	return createOutgoingFileTransfer(to, filename, description, sizeInBytes, lastModified, bytestream);
diff --git a/Swiftob/LuaCommands.cpp b/Swiftob/LuaCommands.cpp
index 27c44eb..89f5159 100644
--- a/Swiftob/LuaCommands.cpp
+++ b/Swiftob/LuaCommands.cpp
@@ -14,6 +14,7 @@
 #include <Swiften/Base/foreach.h>
 #include <Swiften/Client/Client.h>
 #include <Swiften/Network/TimerFactory.h>
+#include <boost/filesystem/operations.hpp>
 
 #include <Swiftob/Commands.h>
 
@@ -405,7 +406,11 @@ void LuaCommands::loadScript(boost::filesystem::path filePath) {
 	luaL_openlibs(lua);
 	lua_pushlightuserdata(lua, this);
 	lua_setfield(lua, LUA_REGISTRYINDEX, LUA_COMMANDS);
-	std::string filename(filePath.filename());
+#if BOOST_FILESYSTEM_VERSION == 2 // TODO: Delete this when boost 1.44 becomes a minimum requirement, and we no longer need v2
+	std::string filename = filePath.filename();
+#else
+	std::string filename = filePath.filename().string();
+#endif
 	filename += ".storage";
 	boost::filesystem::path storagePath(boost::filesystem::path(path_) / filename);
 	Storage* storage = new Storage(storagePath);
diff --git a/Swiftob/Storage.cpp b/Swiftob/Storage.cpp
index 47d0619..141be9f 100644
--- a/Swiftob/Storage.cpp
+++ b/Swiftob/Storage.cpp
@@ -6,6 +6,8 @@
 
 #include <Swiftob/Storage.h>
 
+#include <boost/filesystem/operations.hpp>
+
 #include <Swiften/Base/String.h>
 #include <Swiften/Base/ByteArray.h>
 #include <Swiften/Base/foreach.h>
-- 
cgit v0.10.2-6-g49f6