diff options
Diffstat (limited to 'Swiften/Application/MacOSXApplicationPathProvider.cpp')
-rw-r--r-- | Swiften/Application/MacOSXApplicationPathProvider.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/Application/MacOSXApplicationPathProvider.cpp b/Swiften/Application/MacOSXApplicationPathProvider.cpp index 3b9a797..7e4931a 100644 --- a/Swiften/Application/MacOSXApplicationPathProvider.cpp +++ b/Swiften/Application/MacOSXApplicationPathProvider.cpp @@ -7,6 +7,7 @@ #include "Swiften/Application/MacOSXApplicationPathProvider.h" #include <iostream> +#include <mach-o/dyld.h> namespace Swift { @@ -28,4 +29,17 @@ boost::filesystem::path MacOSXApplicationPathProvider::getHomeDir() const { return boost::filesystem::path(getenv("HOME")); } + +boost::filesystem::path MacOSXApplicationPathProvider::getExecutableDir() const { + ByteArray path; + uint32_t size = 4096; + path.resize(size); + if (_NSGetExecutablePath(path, &size) == 0) { + return boost::filesystem::path(path.toString().getUTF8Data()).parent_path(); + } + else { + return boost::filesystem::path(); + } +} + } |