summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Application')
-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 {