summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Application/UnixApplicationPathProvider.h')
-rw-r--r--Swiften/Application/UnixApplicationPathProvider.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/Application/UnixApplicationPathProvider.h b/Swiften/Application/UnixApplicationPathProvider.h
index 04387f7..170d53a 100644
--- a/Swiften/Application/UnixApplicationPathProvider.h
+++ b/Swiften/Application/UnixApplicationPathProvider.h
@@ -9,6 +9,7 @@
#include "Swiften/Application/ApplicationPathProvider.h"
#include <iostream>
+#include <unistd.h>
namespace Swift {
class UnixApplicationPathProvider : public ApplicationPathProvider {
@@ -30,6 +31,19 @@ namespace Swift {
}
return result;
}
+
+ virtual boost::filesystem::path getExecutableDir() const {
+ ByteArray path;
+ path.resize(SSIZE_MAX);
+ size_t size = readlink("/proc/self/exe", path.getData(), path.getSize());
+ if (size > 0) {
+ path.resize(size);
+ return boost::filesystem::path(path.toString().getUTF8Data()).parent_path();
+ }
+ else {
+ return boost::filesystem::path();
+ }
+ }
};
}