diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-20 18:56:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-20 18:56:17 (GMT) |
commit | 3e37086b581d49d4112eafa3ae21df9b95314081 (patch) | |
tree | 24fd19ef4ae96be452542d94b3da93d15f6e46b2 /Swiften | |
parent | b3dc968b7c424351bac87bfed42681bd0500d86c (diff) | |
download | swift-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.h | 14 |
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 { |