summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Application')
-rw-r--r--Swiften/Application/Application.cpp8
-rw-r--r--Swiften/Application/MacOSX/MacOSXApplication.cpp9
-rw-r--r--Swiften/Application/Unix/UnixApplication.h9
3 files changed, 23 insertions, 3 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;
}