summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2013-05-15 19:44:37 (GMT)
committerRemko Tronçon <git@el-tramo.be>2013-05-17 19:00:55 (GMT)
commitde39ce6ec44647cee92853e2928cf5475af992e6 (patch)
tree1f86dd075900aeeb9b91cdd120d71052458ca6ff /Swiften
parent927d62cc54c8a5087dba6b61afa9ad30dc528a23 (diff)
downloadswift-de39ce6ec44647cee92853e2928cf5475af992e6.zip
swift-de39ce6ec44647cee92853e2928cf5475af992e6.tar.bz2
Fixed unicode path handling.
- Use boost::filesystem::path consistently for referring to files. - Use boost::filesystem streams for I/O, such that paths are always handled correctly. - Use stringToPath and pathToString for conversion between strings and boost::filesystem::path, to ensure we have consistent unicode handling across platforms and environments. The default constructor and string conversion uses platform-dependent encoding, depending on the global locale set in the application, which causes problems. So, unless you are in platform dependent code, the default constructor and string() function should not be used. When constructing paths from other paths (e.g. using operator/), also use stringToPath (instead of string arguments) if the path can contain unicode characters. Change-Id: If286bd9e71c8414afc0b24ba67e26ab7608ef6ea
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/ByteArray.cpp6
-rw-r--r--Swiften/Base/ByteArray.h3
-rw-r--r--Swiften/Base/Path.cpp28
-rw-r--r--Swiften/Base/Path.h27
-rw-r--r--Swiften/Base/Paths.cpp7
-rw-r--r--Swiften/Base/SConscript1
-rw-r--r--Swiften/Base/String.cpp39
-rw-r--r--Swiften/Base/String.h7
-rw-r--r--Swiften/Base/UnitTest/PathTest.cpp36
-rw-r--r--Swiften/Base/UnitTest/StringTest.cpp15
-rw-r--r--Swiften/Config/SConscript8
-rw-r--r--Swiften/Config/swiften-config.cpp9
-rw-r--r--Swiften/Entity/PayloadPersister.cpp2
-rw-r--r--Swiften/Examples/SendFile/SendFile.cpp2
-rw-r--r--Swiften/FileTransfer/FileTransferManagerImpl.cpp3
-rw-r--r--Swiften/History/SQLiteHistoryStorage.cpp9
-rw-r--r--Swiften/History/SQLiteHistoryStorage.h5
-rw-r--r--Swiften/QA/StorageTest/VCardFileStorageTest.cpp2
-rw-r--r--Swiften/QA/TLSTest/CertificateTest.cpp2
-rw-r--r--Swiften/SConscript1
-rw-r--r--Swiften/TLS/PKCS12Certificate.h3
21 files changed, 190 insertions, 25 deletions
diff --git a/Swiften/Base/ByteArray.cpp b/Swiften/Base/ByteArray.cpp
index d6b5c97..466db5f 100644
--- a/Swiften/Base/ByteArray.cpp
+++ b/Swiften/Base/ByteArray.cpp
@@ -7,14 +7,14 @@
#include <Swiften/Base/ByteArray.h>
#include <boost/numeric/conversion/cast.hpp>
-#include <fstream>
+#include <boost/filesystem/fstream.hpp>
namespace Swift {
static const int BUFFER_SIZE = 4096;
-void readByteArrayFromFile(ByteArray& data, const std::string& file) {
- std::ifstream input(file.c_str(), std::ios_base::in|std::ios_base::binary);
+void readByteArrayFromFile(ByteArray& data, const boost::filesystem::path& file) {
+ boost::filesystem::ifstream input(file, std::ios_base::in|std::ios_base::binary);
while (input.good()) {
size_t oldSize = data.size();
data.resize(oldSize + BUFFER_SIZE);
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h
index 8688aab..133b75f 100644
--- a/Swiften/Base/ByteArray.h
+++ b/Swiften/Base/ByteArray.h
@@ -10,6 +10,7 @@
#include <string>
#include <Swiften/Base/API.h>
+#include <boost/filesystem/path.hpp>
namespace Swift {
typedef std::vector<unsigned char> ByteArray;
@@ -41,6 +42,6 @@ namespace Swift {
SWIFTEN_API std::string byteArrayToString(const ByteArray& b);
- SWIFTEN_API void readByteArrayFromFile(ByteArray&, const std::string& file);
+ SWIFTEN_API void readByteArrayFromFile(ByteArray&, const boost::filesystem::path& file);
}
diff --git a/Swiften/Base/Path.cpp b/Swiften/Base/Path.cpp
new file mode 100644
index 0000000..2a49676
--- /dev/null
+++ b/Swiften/Base/Path.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Base/Path.h>
+
+#include <Swiften/Base/Platform.h>
+#include <Swiften/Base/String.h>
+
+using namespace Swift;
+
+boost::filesystem::path Swift::stringToPath(const std::string& path) {
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ return boost::filesystem::path(convertStringToWString(path));
+#else
+ return boost::filesystem::path(path);
+#endif
+}
+
+std::string Swift::pathToString(const boost::filesystem::path& path) {
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ return convertWStringToString(path.native());
+#else
+ return path.native();
+#endif
+}
diff --git a/Swiften/Base/Path.h b/Swiften/Base/Path.h
new file mode 100644
index 0000000..ea99be9
--- /dev/null
+++ b/Swiften/Base/Path.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <boost/filesystem/path.hpp>
+#include <string>
+
+namespace Swift {
+ /**
+ * Creates a path for the given UTF-8 encoded string.
+ * This works independently of global locale settings.
+ */
+ SWIFTEN_API boost::filesystem::path stringToPath(const std::string&);
+
+ /**
+ * Returns the UTF-8 representation of the given path
+ * This works independently of global locale settings.
+ */
+ SWIFTEN_API std::string pathToString(const boost::filesystem::path&);
+}
+
+
diff --git a/Swiften/Base/Paths.cpp b/Swiften/Base/Paths.cpp
index d434cc1..8ad1159 100644
--- a/Swiften/Base/Paths.cpp
+++ b/Swiften/Base/Paths.cpp
@@ -36,10 +36,11 @@ boost::filesystem::path Paths::getExecutablePath() {
return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(path)), path.size()).c_str()).parent_path();
}
#elif defined(SWIFTEN_PLATFORM_WINDOWS)
- ByteArray data;
+ std::vector<wchar_t> data;
data.resize(2048);
- GetModuleFileName(NULL, reinterpret_cast<char*>(vecptr(data)), data.size());
- return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(data)), data.size()).c_str()).parent_path();
+ GetModuleFileNameW(NULL, vecptr(data), data.size());
+ return boost::filesystem::path(
+ std::wstring(vecptr(data), data.size())).parent_path();
#endif
return boost::filesystem::path();
}
diff --git a/Swiften/Base/SConscript b/Swiften/Base/SConscript
index b56db8c..4956fba 100644
--- a/Swiften/Base/SConscript
+++ b/Swiften/Base/SConscript
@@ -7,6 +7,7 @@ objects = swiften_env.SwiftenObject([
"SafeAllocator.cpp",
"Error.cpp",
"Log.cpp",
+ "Path.cpp",
"Paths.cpp",
"String.cpp",
"IDGenerator.cpp",
diff --git a/Swiften/Base/String.cpp b/Swiften/Base/String.cpp
index 242b8e5..40ea2e1 100644
--- a/Swiften/Base/String.cpp
+++ b/Swiften/Base/String.cpp
@@ -1,15 +1,21 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <Swiften/Base/Platform.h>
+
#include <cassert>
#include <algorithm>
#include <sstream>
#include <iomanip>
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+#include <windows.h>
+#endif
#include <Swiften/Base/String.h>
+#include <Swiften/Base/ByteArray.h>
namespace Swift {
@@ -113,4 +119,35 @@ int String::convertHexStringToInt(const std::string& s) {
return h;
}
+
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+std::string convertWStringToString(const std::wstring& s) {
+ int utf8Size = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, NULL, 0, NULL, NULL);
+ if (utf8Size < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ std::vector<char> utf8Data(utf8Size);
+ int result = WideCharToMultiByte(
+ CP_UTF8, 0, s.c_str(), -1, vecptr(utf8Data), utf8Data.size(), NULL, NULL);
+ if (result < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ return std::string(vecptr(utf8Data), utf8Size-1 /* trailing 0 character */);
+}
+
+std::wstring convertStringToWString(const std::string& s) {
+ int utf16Size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, NULL, 0);
+ if (utf16Size < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ std::vector<wchar_t> utf16Data(utf16Size);
+ int result = MultiByteToWideChar(
+ CP_UTF8, 0, s.c_str(), -1, vecptr(utf16Data), utf16Data.size());
+ if (result < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ return std::wstring(vecptr(utf16Data), utf16Size-1 /* trailing 0 character */);
+}
+#endif
+
}
diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h
index 5ce6c3d..5a5642e 100644
--- a/Swiften/Base/String.h
+++ b/Swiften/Base/String.h
@@ -11,6 +11,7 @@
#include <sstream>
#include <Swiften/Base/API.h>
+#include <Swiften/Base/Platform.h>
#define SWIFTEN_STRING_TO_CFSTRING(a) \
CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.c_str()), a.size(), kCFStringEncodingUTF8, false)
@@ -32,8 +33,14 @@ namespace Swift {
std::string convertIntToHexString(int h);
int convertHexStringToInt(const std::string& s);
+
}
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ SWIFTEN_API std::string convertWStringToString(const std::wstring& s);
+ SWIFTEN_API std::wstring convertStringToWString(const std::string& s);
+#endif
+
class SWIFTEN_API makeString {
public:
template <typename T> makeString& operator<<(T const& v) {
diff --git a/Swiften/Base/UnitTest/PathTest.cpp b/Swiften/Base/UnitTest/PathTest.cpp
new file mode 100644
index 0000000..f5f99e7
--- /dev/null
+++ b/Swiften/Base/UnitTest/PathTest.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <Swiften/Base/Path.h>
+#include <Swiften/Base/Platform.h>
+
+using namespace Swift;
+
+class PathTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(PathTest);
+ CPPUNIT_TEST(testStringToPath);
+ CPPUNIT_TEST(testPathToString);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void testStringToPath() {
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ CPPUNIT_ASSERT(std::wstring(L"tron\xe7on") == stringToPath("tron\xc3\xa7on").native());
+#else
+ CPPUNIT_ASSERT_EQUAL(std::string("tron\xc3\xa7on"), stringToPath("tron\xc3\xa7on").native());
+#endif
+ }
+
+ void testPathToString() {
+ CPPUNIT_ASSERT_EQUAL(std::string("tron\xc3\xa7on"), pathToString(stringToPath("tron\xc3\xa7on")));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PathTest);
+
diff --git a/Swiften/Base/UnitTest/StringTest.cpp b/Swiften/Base/UnitTest/StringTest.cpp
index b29f331..ffca98a 100644
--- a/Swiften/Base/UnitTest/StringTest.cpp
+++ b/Swiften/Base/UnitTest/StringTest.cpp
@@ -9,6 +9,7 @@
#include <string>
#include <Swiften/Base/String.h>
+#include <Swiften/Base/Platform.h>
using namespace Swift;
@@ -24,6 +25,10 @@ class StringTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testReplaceAll_ConsecutiveChars);
CPPUNIT_TEST(testReplaceAll_MatchingReplace);
CPPUNIT_TEST(testSplit);
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ CPPUNIT_TEST(testConvertWStringToString);
+ CPPUNIT_TEST(testConvertStringToWString);
+#endif
CPPUNIT_TEST_SUITE_END();
public:
@@ -109,6 +114,16 @@ class StringTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("def"), result[1]);
CPPUNIT_ASSERT_EQUAL(std::string("ghi"), result[2]);
}
+
+#ifdef SWIFTEN_PLATFORM_WINDOWS
+ void testConvertWStringToString() {
+ CPPUNIT_ASSERT_EQUAL(std::string("tron\xc3\xa7on"), convertWStringToString(std::wstring(L"tron\xe7on")));
+ }
+
+ void testConvertStringToWString() {
+ CPPUNIT_ASSERT(std::wstring(L"tron\xe7on") == convertStringToWString(std::string("tron\xc3\xa7on")));
+ }
+#endif
};
CPPUNIT_TEST_SUITE_REGISTRATION(StringTest);
diff --git a/Swiften/Config/SConscript b/Swiften/Config/SConscript
index 27dfc2e..837884b 100644
--- a/Swiften/Config/SConscript
+++ b/Swiften/Config/SConscript
@@ -37,12 +37,18 @@ config_flags += cStringVariable(swiften_env, "LIBFLAGS", libflags)
config_env = env.Clone()
# Create a local copy of Paths.cpp to avoid a Swiften dependency
-config_env.Install(".", "#/Swiften/Base/Paths.cpp")
+config_env.Install(".", [
+ "#/Swiften/Base/Paths.cpp",
+ "#/Swiften/Base/Path.cpp",
+ "#/Swiften/Base/String.cpp",
+])
config_env.UseFlags(config_env["BOOST_FLAGS"])
config_env.UseFlags(config_env["PLATFORM_FLAGS"])
config_env.WriteVal("swiften-config.h", config_env.Value(config_flags))
swiften_config = config_env.Program("swiften-config", [
"Paths.cpp",
+ "Path.cpp",
+ "String.cpp",
"swiften-config.cpp"
])
diff --git a/Swiften/Config/swiften-config.cpp b/Swiften/Config/swiften-config.cpp
index 89df9cd..778134d 100644
--- a/Swiften/Config/swiften-config.cpp
+++ b/Swiften/Config/swiften-config.cpp
@@ -16,6 +16,7 @@
#include <Swiften/Base/Platform.h>
#include <Swiften/Base/Paths.h>
+#include <Swiften/Base/Path.h>
#include <Swiften/Version.h>
#include "swiften-config.h"
@@ -90,12 +91,12 @@ int main(int argc, char* argv[]) {
for(size_t i = 0; i < libs.size(); ++i) {
if (inPlace) {
std::string lib = libs[i];
- boost::replace_all(lib, "#", topSourcePath.string());
+ boost::replace_all(lib, "#", pathToString(topSourcePath));
libs[i] = lib;
}
else {
std::string lib = libs[i];
- boost::replace_all(lib, "#", (topInstallPath / "lib").string());
+ boost::replace_all(lib, "#", pathToString(topInstallPath / "lib"));
boost::erase_all(lib, "/Swiften");
libs[i] = lib;
}
@@ -103,12 +104,12 @@ int main(int argc, char* argv[]) {
for(size_t i = 0; i < cflags.size(); ++i) {
if (inPlace) {
std::string cflag = cflags[i];
- boost::replace_all(cflag, "#", topSourcePath.string());
+ boost::replace_all(cflag, "#", pathToString(topSourcePath));
cflags[i] = cflag;
}
else {
std::string cflag = cflags[i];
- boost::replace_all(cflag, "#", (topInstallPath / "include").string());
+ boost::replace_all(cflag, "#", pathToString(topInstallPath / "include"));
cflags[i] = cflag;
}
}
diff --git a/Swiften/Entity/PayloadPersister.cpp b/Swiften/Entity/PayloadPersister.cpp
index 729d36a..ace7b4a 100644
--- a/Swiften/Entity/PayloadPersister.cpp
+++ b/Swiften/Entity/PayloadPersister.cpp
@@ -42,7 +42,7 @@ boost::shared_ptr<Payload> PayloadPersister::loadPayload(const boost::filesystem
try {
if (boost::filesystem::exists(path)) {
ByteArray data;
- readByteArrayFromFile(data, path.string());
+ readByteArrayFromFile(data, path);
boost::shared_ptr<PayloadParser> parser(createParser());
PayloadParserTester tester(parser.get());
tester.parse(byteArrayToString(data));
diff --git a/Swiften/Examples/SendFile/SendFile.cpp b/Swiften/Examples/SendFile/SendFile.cpp
index ff49149..b056842 100644
--- a/Swiften/Examples/SendFile/SendFile.cpp
+++ b/Swiften/Examples/SendFile/SendFile.cpp
@@ -64,7 +64,7 @@ class FileSender {
client->sendPresence(Presence::create());
//ByteArray fileData;
- //readByteArrayFromFile(fileData, file.string());
+ //readByteArrayFromFile(fileData, file);
// gather file information
/*StreamInitiationFileInfo fileInfo;
diff --git a/Swiften/FileTransfer/FileTransferManagerImpl.cpp b/Swiften/FileTransfer/FileTransferManagerImpl.cpp
index e6c4796..b832d7e 100644
--- a/Swiften/FileTransfer/FileTransferManagerImpl.cpp
+++ b/Swiften/FileTransfer/FileTransferManagerImpl.cpp
@@ -18,6 +18,7 @@
#include <Swiften/Base/foreach.h>
#include <Swiften/Base/Log.h>
+#include <Swiften/Base/Path.h>
#include "Swiften/Disco/EntityCapsProvider.h"
#include <Swiften/JID/JID.h>
#include <Swiften/Elements/StreamInitiationFileInfo.h>
@@ -130,7 +131,7 @@ OutgoingFileTransfer::ref FileTransferManagerImpl::createOutgoingFileTransfer(
#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();
+ std::string filename = pathToString(filepath.filename());
#endif
boost::uintmax_t sizeInBytes = boost::filesystem::file_size(filepath);
diff --git a/Swiften/History/SQLiteHistoryStorage.cpp b/Swiften/History/SQLiteHistoryStorage.cpp
index 2da389a..dda8766 100644
--- a/Swiften/History/SQLiteHistoryStorage.cpp
+++ b/Swiften/History/SQLiteHistoryStorage.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -11,6 +11,7 @@
#include <sqlite3.h>
#include <Swiften/History/SQLiteHistoryStorage.h>
#include <boost/date_time/gregorian/gregorian.hpp>
+#include <Swiften/Base/Path.h>
inline std::string getEscapedString(const std::string& s) {
std::string result(s);
@@ -25,12 +26,12 @@ inline std::string getEscapedString(const std::string& s) {
namespace Swift {
-SQLiteHistoryStorage::SQLiteHistoryStorage(const std::string& file) : db_(0) {
+SQLiteHistoryStorage::SQLiteHistoryStorage(const boost::filesystem::path& file) : db_(0) {
thread_ = new boost::thread(boost::bind(&SQLiteHistoryStorage::run, this));
- sqlite3_open(file.c_str(), &db_);
+ sqlite3_open(pathToString(file).c_str(), &db_);
if (!db_) {
- std::cerr << "Error opening database " << file << std::endl;
+ std::cerr << "Error opening database " << pathToString(file) << std::endl;
}
char* errorMessage;
diff --git a/Swiften/History/SQLiteHistoryStorage.h b/Swiften/History/SQLiteHistoryStorage.h
index 524247d..2c1ba7a 100644
--- a/Swiften/History/SQLiteHistoryStorage.h
+++ b/Swiften/History/SQLiteHistoryStorage.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -11,13 +11,14 @@
#include <Swiften/Base/API.h>
#include <Swiften/History/HistoryStorage.h>
#include <boost/thread.hpp>
+#include <boost/filesystem/path.hpp>
struct sqlite3;
namespace Swift {
class SWIFTEN_API SQLiteHistoryStorage : public HistoryStorage {
public:
- SQLiteHistoryStorage(const std::string& file);
+ SQLiteHistoryStorage(const boost::filesystem::path& file);
~SQLiteHistoryStorage();
void addMessage(const HistoryMessage& message);
diff --git a/Swiften/QA/StorageTest/VCardFileStorageTest.cpp b/Swiften/QA/StorageTest/VCardFileStorageTest.cpp
index 7667176..4145696 100644
--- a/Swiften/QA/StorageTest/VCardFileStorageTest.cpp
+++ b/Swiften/QA/StorageTest/VCardFileStorageTest.cpp
@@ -49,7 +49,7 @@ class VCardFileStorageTest : public CppUnit::TestFixture {
boost::filesystem::path vcardFile(vcardsPath / "alice@wonderland.lit%2fTeaRoom.xml");
CPPUNIT_ASSERT(boost::filesystem::exists(vcardFile));
ByteArray data;
- data.readFromFile(vcardFile.string());
+ data.readFromFile(vcardFile);
CPPUNIT_ASSERT(boost::starts_with(data.toString(), "<vCard xmlns=\"vcard-temp\">"));
}
diff --git a/Swiften/QA/TLSTest/CertificateTest.cpp b/Swiften/QA/TLSTest/CertificateTest.cpp
index 6932881..2fa4c04 100644
--- a/Swiften/QA/TLSTest/CertificateTest.cpp
+++ b/Swiften/QA/TLSTest/CertificateTest.cpp
@@ -32,7 +32,7 @@ class CertificateTest : public CppUnit::TestFixture {
public:
void setUp() {
pathProvider = new PlatformApplicationPathProvider("FileReadBytestreamTest");
- readByteArrayFromFile(certificateData, (pathProvider->getExecutableDir() / "jabber_org.crt").string());
+ readByteArrayFromFile(certificateData, (pathProvider->getExecutableDir() / "jabber_org.crt"));
certificateFactory = new CERTIFICATE_FACTORY();
}
diff --git a/Swiften/SConscript b/Swiften/SConscript
index 1cb3543..aab9984 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -308,6 +308,7 @@ if env["SCONS_STAGE"] == "build" :
File("Base/UnitTest/DateTimeTest.cpp"),
File("Base/UnitTest/ByteArrayTest.cpp"),
File("Base/UnitTest/URLTest.cpp"),
+ File("Base/UnitTest/PathTest.cpp"),
File("Chat/UnitTest/ChatStateNotifierTest.cpp"),
# File("Chat/UnitTest/ChatStateTrackerTest.cpp"),
File("Client/UnitTest/ClientSessionTest.cpp"),
diff --git a/Swiften/TLS/PKCS12Certificate.h b/Swiften/TLS/PKCS12Certificate.h
index 2f70456..2d4c2e5 100644
--- a/Swiften/TLS/PKCS12Certificate.h
+++ b/Swiften/TLS/PKCS12Certificate.h
@@ -8,13 +8,14 @@
#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/TLS/CertificateWithKey.h>
+#include <boost/filesystem/path.hpp>
namespace Swift {
class PKCS12Certificate : public Swift::CertificateWithKey {
public:
PKCS12Certificate() {}
- PKCS12Certificate(const std::string& filename, const SafeByteArray& password) : password_(password) {
+ PKCS12Certificate(const boost::filesystem::path& filename, const SafeByteArray& password) : password_(password) {
readByteArrayFromFile(data_, filename);
}