diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-20 17:14:02 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-20 18:25:17 (GMT) |
commit | b3dc968b7c424351bac87bfed42681bd0500d86c (patch) | |
tree | 1f3ec7ee8f8b3e9d3e274ba77684b8606dc96377 | |
parent | 5fa4903a7c1c7a7733afdd1d6c4c5dcccec97b19 (diff) | |
download | swift-contrib-b3dc968b7c424351bac87bfed42681bd0500d86c.zip swift-contrib-b3dc968b7c424351bac87bfed42681bd0500d86c.tar.bz2 |
Don't bundle sounds.
-rw-r--r-- | .cproject | 207 | ||||
-rw-r--r-- | Swift/QtUI/QtSoundPlayer.cpp | 19 | ||||
-rw-r--r-- | Swift/QtUI/QtSoundPlayer.h | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 12 | ||||
-rw-r--r-- | Swift/QtUI/Swift.qrc | 1 | ||||
-rw-r--r-- | Swiften/Application/ApplicationPathProvider.cpp | 12 | ||||
-rw-r--r-- | Swiften/Application/ApplicationPathProvider.h | 3 | ||||
-rw-r--r-- | Swiften/Application/MacOSXApplicationPathProvider.cpp | 2 | ||||
-rw-r--r-- | Swiften/Application/MacOSXApplicationPathProvider.h | 7 | ||||
-rw-r--r-- | Swiften/Application/UnixApplicationPathProvider.h | 9 | ||||
-rw-r--r-- | Swiften/Application/WindowsApplicationPathProvider.cpp | 2 | ||||
-rw-r--r-- | Swiften/Application/WindowsApplicationPathProvider.h | 6 |
13 files changed, 283 insertions, 10 deletions
@@ -417,6 +417,213 @@ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/> </cconfiguration> + <cconfiguration id="0.980756260.1834106966.1269306596"> + <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.980756260.1834106966.1269306596" moduleId="org.eclipse.cdt.core.settings" name="Dist"> + <externalSettings/> + <extensions> + <extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/> + <extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> + </extensions> + </storageModule> + <storageModule moduleId="cdtBuildSystem" version="4.0.0"> + <configuration artifactName="${ProjName}" buildProperties="" description="" id="0.980756260.1834106966.1269306596" name="Dist" parent="org.eclipse.cdt.build.core.prefbase.cfg"> + <folderInfo id="0.980756260.1834106966.1269306596." name="/" resourcePath=""> + <toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.90303371" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> + <targetPlatform binaryParser="org.eclipse.cdt.core.MachO64;org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE;org.eclipse.cdt.core.GNU_ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.90303371.929945875" name=""/> + <builder arguments="${ProjDirPath}/3rdParty/SCons/scons.py" autoBuildTarget="dist=1" buildPath="" cleanBuildTarget="-c" command="python" enableAutoBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.1634455769" incrementalBuildTarget="dist=1" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> + <tool id="org.eclipse.cdt.build.core.settings.holder.libs.401471215" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> + <tool id="org.eclipse.cdt.build.core.settings.holder.1623941091" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.849895476" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + <tool id="org.eclipse.cdt.build.core.settings.holder.1862826514" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.67032540" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + <tool id="org.eclipse.cdt.build.core.settings.holder.1542887986" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> + <inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1044521385" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> + </tool> + </toolChain> + </folderInfo> + </configuration> + </storageModule> + <storageModule moduleId="scannerConfiguration"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="makefileGenerator"> + <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <scannerConfigBuildInfo instanceId="0.980756260"> + <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="makefileGenerator"> + <runAction arguments="-E -P -v -dD" command="" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + <profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> + <buildOutputProvider> + <openAction enabled="true" filePath=""/> + <parser enabled="true"/> + </buildOutputProvider> + <scannerInfoProvider id="specsFile"> + <runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> + <parser enabled="true"/> + </scannerInfoProvider> + </profile> + </scannerConfigBuildInfo> + </storageModule> + <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"> <project id="swift.null.189117846" name="swift"/> diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp index 94d2ea5..7fd6564 100644 --- a/Swift/QtUI/QtSoundPlayer.cpp +++ b/Swift/QtUI/QtSoundPlayer.cpp @@ -7,18 +7,31 @@ #include "QtSoundPlayer.h" #include <QSound> +#include <iostream> + +#include "Swiften/Application/ApplicationPathProvider.h" namespace Swift { -QtSoundPlayer::QtSoundPlayer() { +QtSoundPlayer::QtSoundPlayer(ApplicationPathProvider* applicationPathProvider) : applicationPathProvider(applicationPathProvider) { } void QtSoundPlayer::playSound(SoundEffect sound) { switch (sound) { - case MessageReceived: - QSound::play(":/sounds/message-received.wav"); + case MessageReceived: + playSound("/sounds/message-received.wav"); break; } } +void QtSoundPlayer::playSound(const String& soundResource) { + boost::filesystem::path resourcePath = applicationPathProvider->getResourcePath(soundResource); + if (boost::filesystem::exists(resourcePath)) { + QSound::play(resourcePath.string().c_str()); + } + else { + std::cerr << "Unable to find sound: " << soundResource << std::endl; + } +} + } diff --git a/Swift/QtUI/QtSoundPlayer.h b/Swift/QtUI/QtSoundPlayer.h index 89e2935..21ad8bb 100644 --- a/Swift/QtUI/QtSoundPlayer.h +++ b/Swift/QtUI/QtSoundPlayer.h @@ -11,11 +11,20 @@ #include <QObject> namespace Swift { + class ApplicationPathProvider; + class String; + class QtSoundPlayer : public QObject, public SoundPlayer { Q_OBJECT public: - QtSoundPlayer(); + QtSoundPlayer(ApplicationPathProvider* applicationPathProvider); void playSound(SoundEffect sound); + + private: + void playSound(const String& soundResource); + + private: + ApplicationPathProvider* applicationPathProvider; }; } diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index ef02096..55bc112 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -80,7 +80,7 @@ QtSwift::QtSwift(po::variables_map options) : autoUpdater_(NULL) { applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME); avatarStorage_ = new AvatarFileStorage(applicationPathProvider_->getAvatarDir()); chatWindowFactory_ = new QtChatWindowFactory(splitter_, settings_, tabs_); - soundPlayer_ = new QtSoundPlayer(); + soundPlayer_ = new QtSoundPlayer(applicationPathProvider_); if (splitter_) { splitter_->show(); } diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 6c30f42..0d043fb 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -127,11 +127,13 @@ myenv.Uic4("QtBookmarkDetailWindow.ui") myenv.Qrc("DefaultTheme.qrc") myenv.Qrc("Swift.qrc") +commonResources = ["../resources/sounds"] + if env["PLATFORM"] == "darwin" : frameworks = [] if env["HAVE_SPARKLE"] : frameworks.append(env["SPARKLE_FRAMEWORK"]) - app = myenv.AppBundle("Swift", version = myenv["SWIFT_VERSION"], resources = ["../resources/MacOSX/Swift.icns"], frameworks = frameworks) + app = myenv.AppBundle("Swift", version = myenv["SWIFT_VERSION"], resources = ["../resources/MacOSX/Swift.icns"] + commonResources, frameworks = frameworks) if env["DIST"] : myenv.Command(["Swift-${SWIFT_VERSION}.dmg"], [app], [ "$QTDIR/bin/macdeployqt $SOURCE -dmg", @@ -142,13 +144,15 @@ if env.get("SWIFT_INSTALLDIR", "") : env.Install(os.path.join(env["SWIFT_INSTALLDIR"], "bin"), swiftProgram) env.InstallAs(os.path.join(env["SWIFT_INSTALLDIR"], "share", "pixmaps", "swift.xpm"), "../resources/logo/logo-icon-32.xpm") env.Install(os.path.join(env["SWIFT_INSTALLDIR"], "share", "applications"), "../resources/swift.desktop") - + for resource in commonResources : + env.Install(os.path.join(env["SWIFT_INSTALLDIR"], "share", "swift"), resource) + if env["PLATFORM"] == "win32" : if env["DIST"] : myenv.WindowsBundle("Swift", resources = [ os.path.join(env["OPENSSL_DIR"], "bin", "ssleay32.dll"), - os.path.join(env["OPENSSL_DIR"], "bin", "libeay32.dll"), - ], + os.path.join(env["OPENSSL_DIR"], "bin", "libeay32.dll"), + ] + commonResources, qtimageformats = ["gif", "ico", "jpeg", "mng", "svg", "tiff"], qtlibs = ["QtCore4", "QtGui4", "QtNetwork4", "QtWebKit4", "QtXMLPatterns4", "phonon4"]) diff --git a/Swift/QtUI/Swift.qrc b/Swift/QtUI/Swift.qrc index b14569e..4da687c 100644 --- a/Swift/QtUI/Swift.qrc +++ b/Swift/QtUI/Swift.qrc @@ -13,7 +13,6 @@ <file alias="icons/avatar.png">../resources/icons/avatar.png</file> <file alias="icons/tray-standard.png">../resources/icons/tray-standard.png</file> <file alias="icons/new-chat.png">../resources/icons/new-chat.png</file> - <file alias="sounds/message-received.wav">../resources/sounds/message-received.wav</file> <file alias="COPYING">../../COPYING</file> </qresource> </RCC> diff --git a/Swiften/Application/ApplicationPathProvider.cpp b/Swiften/Application/ApplicationPathProvider.cpp index ec19160..47ef1ad 100644 --- a/Swiften/Application/ApplicationPathProvider.cpp +++ b/Swiften/Application/ApplicationPathProvider.cpp @@ -10,6 +10,7 @@ #include <iostream> #include "Swiften/Application/ApplicationPathProvider.h" +#include "Swiften/Base/foreach.h" namespace Swift { @@ -38,4 +39,15 @@ boost::filesystem::path ApplicationPathProvider::getProfileDir(const String& pro return result; } +boost::filesystem::path ApplicationPathProvider::getResourcePath(const String& resource) const { + std::vector<boost::filesystem::path> resourcePaths = getResourceDirs(); + foreach(const boost::filesystem::path& resourcePath, resourcePaths) { + boost::filesystem::path r(resourcePath / resource.getUTF8String()); + if (boost::filesystem::exists(r)) { + return r; + } + } + return boost::filesystem::path(); +} + } diff --git a/Swiften/Application/ApplicationPathProvider.h b/Swiften/Application/ApplicationPathProvider.h index cf97299..e9c0864 100644 --- a/Swiften/Application/ApplicationPathProvider.h +++ b/Swiften/Application/ApplicationPathProvider.h @@ -7,6 +7,7 @@ #pragma once #include <boost/filesystem.hpp> +#include <vector> #include "Swiften/Base/String.h" @@ -22,8 +23,10 @@ namespace Swift { virtual boost::filesystem::path getSettingsDir() const = 0; virtual boost::filesystem::path getExecutableDir() const = 0; boost::filesystem::path getProfileDir(const String& profile) const; + boost::filesystem::path getResourcePath(const String& resource) const; protected: + virtual std::vector<boost::filesystem::path> getResourceDirs() const = 0; const String& getApplicationName() const { return applicationName; } diff --git a/Swiften/Application/MacOSXApplicationPathProvider.cpp b/Swiften/Application/MacOSXApplicationPathProvider.cpp index e4b17da..08ce885 100644 --- a/Swiften/Application/MacOSXApplicationPathProvider.cpp +++ b/Swiften/Application/MacOSXApplicationPathProvider.cpp @@ -14,6 +14,8 @@ namespace Swift { MacOSXApplicationPathProvider::MacOSXApplicationPathProvider(const String& name) : ApplicationPathProvider(name) { + resourceDirs.push_back(getExecutableDir() / "../Resources"); + resourceDirs.push_back(getExecutableDir() / "../resources"); // Development } boost::filesystem::path MacOSXApplicationPathProvider::getSettingsDir() const { diff --git a/Swiften/Application/MacOSXApplicationPathProvider.h b/Swiften/Application/MacOSXApplicationPathProvider.h index e03c753..72cfb38 100644 --- a/Swiften/Application/MacOSXApplicationPathProvider.h +++ b/Swiften/Application/MacOSXApplicationPathProvider.h @@ -16,5 +16,12 @@ namespace Swift { virtual boost::filesystem::path getHomeDir() const; boost::filesystem::path getSettingsDir() const; virtual boost::filesystem::path getExecutableDir() const; + + virtual std::vector<boost::filesystem::path> getResourceDirs() const { + return resourceDirs; + } + + private: + std::vector<boost::filesystem::path> resourceDirs; }; } diff --git a/Swiften/Application/UnixApplicationPathProvider.h b/Swiften/Application/UnixApplicationPathProvider.h index 50cd4be..676cb94 100644 --- a/Swiften/Application/UnixApplicationPathProvider.h +++ b/Swiften/Application/UnixApplicationPathProvider.h @@ -17,6 +17,8 @@ namespace Swift { class UnixApplicationPathProvider : public ApplicationPathProvider { public: UnixApplicationPathProvider(const String& name) : ApplicationPathProvider(name) { + resourceDirs.push_back("/usr/share/swift"); + resourceDirs.push_back(getExecutableDir() / "../resources"); // Development } virtual boost::filesystem::path getHomeDir() const { @@ -46,6 +48,13 @@ namespace Swift { return boost::filesystem::path(); } } + + virtual std::vector<boost::filesystem::path> getResourceDirs() const { + return resourceDirs; + } + + private: + std::vector<boost::filesystem::path> resourceDirs; }; } diff --git a/Swiften/Application/WindowsApplicationPathProvider.cpp b/Swiften/Application/WindowsApplicationPathProvider.cpp index 2e84e90..e02da1e 100644 --- a/Swiften/Application/WindowsApplicationPathProvider.cpp +++ b/Swiften/Application/WindowsApplicationPathProvider.cpp @@ -13,6 +13,8 @@ namespace Swift { WindowsApplicationPathProvider::WindowsApplicationPathProvider(const String& name) : ApplicationPathProvider(name) { + resourceDirs.push_back(getExecutableDir()); + resourceDirs.push_back(getExecutableDir() / "../resources"); // Development } boost::filesystem::path WindowsApplicationPathProvider::getExecutableDir() const { diff --git a/Swiften/Application/WindowsApplicationPathProvider.h b/Swiften/Application/WindowsApplicationPathProvider.h index 1ba4298..1879300 100644 --- a/Swiften/Application/WindowsApplicationPathProvider.h +++ b/Swiften/Application/WindowsApplicationPathProvider.h @@ -28,5 +28,11 @@ namespace Swift { } virtual boost::filesystem::path getExecutableDir() const; + virtual std::vector<boost::filesystem::path> getResourceDirs() const { + return resourceDirs; + } + + private: + std::vector<boost::filesystem::path> resourceDirs; }; } |