summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-08-20 18:56:17 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-08-20 18:56:17 (GMT)
commit3e37086b581d49d4112eafa3ae21df9b95314081 (patch)
tree24fd19ef4ae96be452542d94b3da93d15f6e46b2 /Swiften
parentb3dc968b7c424351bac87bfed42681bd0500d86c (diff)
downloadswift-contrib-3e37086b581d49d4112eafa3ae21df9b95314081.zip
swift-contrib-3e37086b581d49d4112eafa3ae21df9b95314081.tar.bz2
Make resource paths comply with OpenDesktop standards.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Application/UnixApplicationPathProvider.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/Swiften/Application/UnixApplicationPathProvider.h b/Swiften/Application/UnixApplicationPathProvider.h
index 676cb94..92cb6dd 100644
--- a/Swiften/Application/UnixApplicationPathProvider.h
+++ b/Swiften/Application/UnixApplicationPathProvider.h
@@ -12,13 +12,25 @@
#include <unistd.h>
#include "Swiften/Base/ByteArray.h"
+#include "Swiften/Base/foreach.h"
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
+ char* xdgDataDirs = getenv("XDG_DATA_DIRS");
+ if (xdgDataDirs) {
+ std::vector<String> dataDirs = String(xdgDataDirs).split(":");
+ if (!dataDirs.empty()) {
+ foreach(const String& dir, dataDirs) {
+ resourceDirs.push_back(boost::filesystem::path(dir.getUTF8String()) / "swift");
+ }
+ return;
+ }
+ }
+ resourceDirs.push_back("/usr/local/share/swift");
+ resourceDirs.push_back("/usr/share/swift");
}
virtual boost::filesystem::path getHomeDir() const {