From 3a7c72e4d4ef968f87425b3394eb5e2aa7882e20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Thu, 19 Aug 2010 20:02:47 +0200
Subject: Fixed compilation on OS X.


diff --git a/.cproject b/.cproject
index 842628d..400d104 100644
--- a/.cproject
+++ b/.cproject
@@ -208,6 +208,7 @@
 			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
 			<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 			<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+			<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
 		</cconfiguration>
 		<cconfiguration id="0.980756260.1834106966">
 			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.980756260.1834106966" moduleId="org.eclipse.cdt.core.settings" name="Unit tests">
@@ -414,6 +415,7 @@
 			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
 			<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 			<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
+			<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
 		</cconfiguration>
 	</storageModule>
 	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
diff --git a/BuildTools/Eclipse/Swift (Mac OS X).launch b/BuildTools/Eclipse/Swift (Mac OS X).launch
new file mode 100644
index 0000000..aeb7576
--- /dev/null
+++ b/BuildTools/Eclipse/Swift (Mac OS X).launch	
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
+<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
+<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Swift/QtUI/Swift.app/Contents/MacOS/Swift"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="swift"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.980756260.1834106966"/>
+<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/swift"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+</launchConfiguration>
diff --git a/Slimber/MainController.cpp b/Slimber/MainController.cpp
index 3699498..5c624a2 100644
--- a/Slimber/MainController.cpp
+++ b/Slimber/MainController.cpp
@@ -11,7 +11,7 @@
 #include <iostream>
 
 #include "Swiften/Base/foreach.h"
-#include "Swiften/Application/Platform/PlatformApplication.h"
+#include "Swiften/Application/PlatformApplicationPathProvider.h"
 #include "Swiften/LinkLocal/LinkLocalService.h"
 #include "Swiften/LinkLocal/LinkLocalServiceBrowser.h"
 #include "Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h"
@@ -35,7 +35,7 @@ MainController::MainController(Menulet* menulet) : menulet(menulet) {
 			boost::bind(&MainController::handleServicesChanged, this));
 
 	vCardCollection = new FileVCardCollection(
-			PlatformApplication("Slimber").getSettingsDir());
+			PlatformApplicationPathProvider("Slimber").getSettingsDir());
 
 	server = new Server(5222, 5562, linkLocalServiceBrowser, vCardCollection);
 	server->onStopped.connect(
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index f010c49..4e72cc6 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -64,7 +64,7 @@ static const String CLIENT_VERSION = "1.0-devel";
 static const String CLIENT_NODE = "http://swift.im";
 
 
-MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency)
+MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency)
 	: timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), settings_(settings), loginWindow_(NULL), useDelayForLatency_(useDelayForLatency)  {
 	presenceOracle_ = NULL;
 	avatarManager_ = NULL;
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 2bda61a..36fe59d 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -65,7 +65,7 @@ namespace Swift {
 
 	class MainController {
 		public:
-			MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency);
+			MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, EventWindowFactory* eventWindowFactory, SettingsProvider *settings, SystemTray* systemTray, SoundPlayer* soundPlayer, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory, ChatListWindowFactory* chatListWindowFactory_, MUCSearchWindowFactory* mucSearchWindowFactory, AvatarStorage* avatarStorage, ApplicationMessageDisplay* applicationMessageDisplay, bool useDelayForLatency);
 			~MainController();
 
 
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 84ae3a1..3a56637 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -94,7 +94,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) {
 		chatListWindowFactories_.push_back(chatListWindowFactory);
 		QtMUCSearchWindowFactory* mucSearchWindowFactory = new QtMUCSearchWindowFactory();
 		mucSearchWindowFactories_.push_back(mucSearchWindowFactory);
-		MainController* mainController = new MainController(chatWindowFactory_, rosterWindowFactory, loginWindowFactory, eventWindowFactory, settings_, application_, systemTray, soundPlayer_, xmlConsoleWidgetFactory, chatListWindowFactory, mucSearchWindowFactory, avatarStorage_, application_->getApplicationMessageDisplay(), options.count("latency-debug") > 0);
+		MainController* mainController = new MainController(chatWindowFactory_, rosterWindowFactory, loginWindowFactory, eventWindowFactory, settings_, systemTray, soundPlayer_, xmlConsoleWidgetFactory, chatListWindowFactory, mucSearchWindowFactory, avatarStorage_, application_->getApplicationMessageDisplay(), options.count("latency-debug") > 0);
 		mainControllers_.push_back(mainController);
 	}
 
diff --git a/Swiften/Application/MacOSX/MacOSXApplication.cpp b/Swiften/Application/MacOSX/MacOSXApplication.cpp
index 8e9a948..8212d36 100644
--- a/Swiften/Application/MacOSX/MacOSXApplication.cpp
+++ b/Swiften/Application/MacOSX/MacOSXApplication.cpp
@@ -17,19 +17,4 @@ ApplicationMessageDisplay* MacOSXApplication::getApplicationMessageDisplay() {
 	return &messageDisplay_;
 }
 
-boost::filesystem::path MacOSXApplication::getSettingsDir() const {
-	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;
-}
-
-boost::filesystem::path MacOSXApplication::getHomeDir() const {
-	return boost::filesystem::path(getenv("HOME"));
-}
-
 }
diff --git a/Swiften/Application/MacOSX/MacOSXApplication.h b/Swiften/Application/MacOSX/MacOSXApplication.h
index 95bf29e..f753f72 100644
--- a/Swiften/Application/MacOSX/MacOSXApplication.h
+++ b/Swiften/Application/MacOSX/MacOSXApplication.h
@@ -4,8 +4,9 @@
  * See Documentation/Licenses/GPLv3.txt for more information.
  */
 
-#ifndef SWIFTEN_MacOSXApplication_H
-#define SWIFTEN_MacOSXApplication_H
+#pragma once
+
+#include <boost/filesystem.hpp>
 
 #include "Swiften/Application/Application.h"
 #include "Swiften/Application/MacOSX/MacOSXApplicationMessageDisplay.h"
@@ -18,14 +19,10 @@ namespace Swift {
 		public:
 			MacOSXApplication(const String& name);
 
-			virtual boost::filesystem::path getHomeDir() const;
-			virtual ApplicationMessageDisplay* getApplicationMessageDisplay();
-			boost::filesystem::path getSettingsDir() const;
+			ApplicationMessageDisplay* getApplicationMessageDisplay();
 
 		private:
 			MacOSXApplicationInitializer initializer_;
 			MacOSXApplicationMessageDisplay messageDisplay_;
 	};
 }
-
-#endif
diff --git a/Swiften/Application/MacOSXApplicationPathProvider.cpp b/Swiften/Application/MacOSXApplicationPathProvider.cpp
index e679517..3b9a797 100644
--- a/Swiften/Application/MacOSXApplicationPathProvider.cpp
+++ b/Swiften/Application/MacOSXApplicationPathProvider.cpp
@@ -14,13 +14,13 @@ MacOSXApplicationPathProvider::MacOSXApplicationPathProvider(const String& name)
 }
 
 boost::filesystem::path MacOSXApplicationPathProvider::getSettingsDir() const {
+	boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getApplicationName().getUTF8String());
 	try {
-		boost::filesystem::path result(getHomeDir() / "Library/Application Support" / getApplicationName().getUTF8String());
+		boost::filesystem::create_directory(result);
 	}
 	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/SConscript b/Swiften/Application/SConscript
index 69e755a..2eacc80 100644
--- a/Swiften/Application/SConscript
+++ b/Swiften/Application/SConscript
@@ -11,7 +11,7 @@ if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native" :
 			"MacOSX/MacOSXApplication.cpp",
 			"MacOSX/MacOSXApplicationMessageDisplay.mm",
 			"MacOSX/MacOSXApplicationInitializer.mm",
-			"MacOSX/MacOSXApplicationPathProvider.cpp",
+			"MacOSXApplicationPathProvider.cpp",
 		]
 elif swiften_env["PLATFORM"] == "win32" :
 	sources += [
-- 
cgit v0.10.2-6-g49f6