summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-07-14 16:24:31 -0400
committerNat Goodspeed <nat@lindenlab.com>2011-07-14 16:24:31 -0400
commit624c3f1a8e503a3a577b81e06b0ae3344e8ede17 (patch)
treed53c217467323b77b5f55a8a8ada358ef14d6aa4 /indra/llcommon
parent24508cc924938d2a8752496b9752b7c4d934dd77 (diff)
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.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp25
1 files changed, 24 insertions, 1 deletions
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<U8> 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;