diff options
-rw-r--r-- | Swiften/Application/Application.cpp | 8 | ||||
-rw-r--r-- | Swiften/Application/MacOSX/MacOSXApplication.cpp | 9 | ||||
-rw-r--r-- | Swiften/Application/Unix/UnixApplication.h | 9 | ||||
-rw-r--r-- | Swiften/Avatars/AvatarFileStorage.cpp | 7 |
4 files changed, 29 insertions, 4 deletions
diff --git a/Swiften/Application/Application.cpp b/Swiften/Application/Application.cpp index 24545cb..d9f4a86 100644 --- a/Swiften/Application/Application.cpp +++ b/Swiften/Application/Application.cpp @@ -6,6 +6,7 @@ #include "Swiften/Application/Application.h" +#include <iostream> #include <boost/filesystem.hpp> #include <stdlib.h> @@ -29,7 +30,12 @@ boost::filesystem::path Application::getAvatarDir() const { boost::filesystem::path Application::getProfileDir(const String& profile) const { boost::filesystem::path result(getHomeDir() / profile.getUTF8String()); - boost::filesystem::create_directory(result); + try { + boost::filesystem::create_directory(result); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } return result; } diff --git a/Swiften/Application/MacOSX/MacOSXApplication.cpp b/Swiften/Application/MacOSX/MacOSXApplication.cpp index ca73274..8e9a948 100644 --- a/Swiften/Application/MacOSX/MacOSXApplication.cpp +++ b/Swiften/Application/MacOSX/MacOSXApplication.cpp @@ -6,6 +6,8 @@ #include "Swiften/Application/MacOSX/MacOSXApplication.h" +#include <iostream> + namespace Swift { MacOSXApplication::MacOSXApplication(const String& name) : Application(name) { @@ -16,7 +18,12 @@ ApplicationMessageDisplay* MacOSXApplication::getApplicationMessageDisplay() { } boost::filesystem::path MacOSXApplication::getSettingsDir() const { - boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getName().getUTF8String()); + try { + boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getName().getUTF8String()); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } boost::filesystem::create_directory(result); return result; } diff --git a/Swiften/Application/Unix/UnixApplication.h b/Swiften/Application/Unix/UnixApplication.h index 1c985e8..56ee0ed 100644 --- a/Swiften/Application/Unix/UnixApplication.h +++ b/Swiften/Application/Unix/UnixApplication.h @@ -10,6 +10,8 @@ #include "Swiften/Application/Application.h" #include "Swiften/Application/NullApplicationMessageDisplay.h" +#include <iostream> + namespace Swift { class UnixApplication : public Application { public: @@ -26,7 +28,12 @@ namespace Swift { boost::filesystem::path getSettingsDir() const { boost::filesystem::path result(getHomeDir() / ("." + getName().getLowerCase().getUTF8String())); - boost::filesystem::create_directory(result); + try { + boost::filesystem::create_directory(result); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } return result; } diff --git a/Swiften/Avatars/AvatarFileStorage.cpp b/Swiften/Avatars/AvatarFileStorage.cpp index c323c0e..a0ebd21 100644 --- a/Swiften/Avatars/AvatarFileStorage.cpp +++ b/Swiften/Avatars/AvatarFileStorage.cpp @@ -12,7 +12,12 @@ namespace Swift { AvatarFileStorage::AvatarFileStorage(const boost::filesystem::path& path) : path_(path) { - boost::filesystem::create_directory(path_); + try { + boost::filesystem::create_directory(path_); + } + catch (const boost::filesystem::filesystem_error& e) { + std::cerr << "ERROR: " << e.what() << std::endl; + } } bool AvatarFileStorage::hasAvatar(const String& hash) const { |