diff options
Diffstat (limited to 'Swiften/Avatars/AvatarFileStorage.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Avatars/AvatarFileStorage.cpp | 26 |
2 files changed, 0 insertions, 26 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Avatars/AvatarFileStorage.cpp b/Swiften/Avatars/AvatarFileStorage.cpp deleted file mode 100644 index 1348018..0000000 --- a/Swiften/Avatars/AvatarFileStorage.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "Swiften/Avatars/AvatarFileStorage.h" - -#include <iostream> -#include <boost/filesystem/fstream.hpp> - -namespace Swift { - -AvatarFileStorage::AvatarFileStorage(const boost::filesystem::path& path) : path_(path) { - boost::filesystem::create_directory(path_); -} - -bool AvatarFileStorage::hasAvatar(const String& hash) const { - return boost::filesystem::exists(getAvatarPath(hash)); -} - -void AvatarFileStorage::addAvatar(const String& hash, const ByteArray& avatar) { - boost::filesystem::ofstream file(getAvatarPath(hash), boost::filesystem::ofstream::binary|boost::filesystem::ofstream::out); - file.write(avatar.getData(), avatar.getSize()); - file.close(); -} - -boost::filesystem::path AvatarFileStorage::getAvatarPath(const String& hash) const { - return path_ / hash.getUTF8String(); -} - -} |