From 624c3f1a8e503a3a577b81e06b0ae3344e8ede17 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 14 Jul 2011 16:24:31 -0400 Subject: Use Linden wstring-to-string conversion, not boost::filesystem's. On Windows, calling boost::filesystem::path::string() implicitly requests code conversion between std::wstring (the boost::filesystem::path::string_type selected on Windows) and std::string. At least for integration-test program, that produces link errors. Use Linden's wstring_to_utf8str() instead. --- indra/llcommon/tests/llsdserialize_test.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/tests/llsdserialize_test.cpp') diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index e0a7835550..93261fa306 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -54,6 +54,7 @@ typedef U32 uint32_t; #include "../test/lltut.h" #include "stringize.h" +#include "llstring.h" std::vector string_to_vector(const std::string& str) { @@ -81,6 +82,28 @@ boost::filesystem::path temp_directory_path() #endif // LL_DARWIN, LL_LINUX } +// We want a std::string from a boost::filesystem::path::native() call. While +// there is a boost::filesystem::path::string() call as well, invoking that +// (at least in this test-program context) produces unresolved externals for +// boost::filesystem::path conversion machinery even though we can resolve +// other boost::filesystem symbols. Possibly those conversion routines aren't +// being built for Linden's Boost package. But that's okay, llstring.h +// provides conversion machinery we can use instead. +// On Posix platforms, boost::filesystem::path::native() returns std::string. +inline +std::string native_to_string(const std::string& in) +{ + return in; +} + +// On Windows, though, boost::filesystem::path::native() returns std::wstring. +// Make sure the right conversion happens. +inline +std::string native_to_string(const std::wstring& in) +{ + return wstring_to_utf8str(in); +} + // Create a Python script file with specified content "somewhere in the // filesystem," cleaning up when it goes out of scope. class NamedTempScript @@ -99,7 +122,7 @@ public: boost::filesystem::remove(mPath); } - std::string getName() const { return mPath.string(); } + std::string getName() const { return native_to_string(mPath.native()); } private: boost::filesystem::path mPath; -- cgit v1.2.3