summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-28 18:34:56 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-11-28 10:56:49 (GMT)
commitab6bac1ee3ba4ebf4dfc8dc1a3ae6783756c48c9 (patch)
treedc69a9a658683b7f3caa81a06040dcbd4d87acc8 /SwifTools/Application
parent34eb7f55fbdd1566ee117738f3a423354ce1b45c (diff)
downloadswift-contrib-ab6bac1ee3ba4ebf4dfc8dc1a3ae6783756c48c9.zip
swift-contrib-ab6bac1ee3ba4ebf4dfc8dc1a3ae6783756c48c9.tar.bz2
Added swiften-config.
Diffstat (limited to 'SwifTools/Application')
-rw-r--r--SwifTools/Application/ApplicationPathProvider.cpp5
-rw-r--r--SwifTools/Application/ApplicationPathProvider.h2
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.cpp13
-rw-r--r--SwifTools/Application/MacOSXApplicationPathProvider.h1
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.cpp13
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.h1
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.cpp7
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.h1
8 files changed, 6 insertions, 37 deletions
diff --git a/SwifTools/Application/ApplicationPathProvider.cpp b/SwifTools/Application/ApplicationPathProvider.cpp
index 2c5db7e..8457f88 100644
--- a/SwifTools/Application/ApplicationPathProvider.cpp
+++ b/SwifTools/Application/ApplicationPathProvider.cpp
@@ -9,6 +9,7 @@
#include "SwifTools/Application/ApplicationPathProvider.h"
#include "Swiften/Base/foreach.h"
+#include "Swiften/Base/Paths.h"
namespace Swift {
@@ -40,4 +41,8 @@ boost::filesystem::path ApplicationPathProvider::getResourcePath(const String& r
return boost::filesystem::path();
}
+boost::filesystem::path ApplicationPathProvider::getExecutableDir() const {
+ return Paths::getExecutablePath();
+}
+
}
diff --git a/SwifTools/Application/ApplicationPathProvider.h b/SwifTools/Application/ApplicationPathProvider.h
index 0c2d302..722f1ad 100644
--- a/SwifTools/Application/ApplicationPathProvider.h
+++ b/SwifTools/Application/ApplicationPathProvider.h
@@ -19,7 +19,7 @@ namespace Swift {
virtual boost::filesystem::path getHomeDir() const = 0;
virtual boost::filesystem::path getDataDir() const = 0;
- virtual boost::filesystem::path getExecutableDir() const = 0;
+ virtual boost::filesystem::path getExecutableDir() const;
boost::filesystem::path getProfileDir(const String& profile) const;
boost::filesystem::path getResourcePath(const String& resource) const;
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.cpp b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
index eb6c63f..fb6523c 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.cpp
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.cpp
@@ -33,17 +33,4 @@ 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.getData(), &size) == 0) {
- return boost::filesystem::path(path.toString().getUTF8Data()).parent_path();
- }
- else {
- return boost::filesystem::path();
- }
-}
-
}
diff --git a/SwifTools/Application/MacOSXApplicationPathProvider.h b/SwifTools/Application/MacOSXApplicationPathProvider.h
index a914ded..d2613f8 100644
--- a/SwifTools/Application/MacOSXApplicationPathProvider.h
+++ b/SwifTools/Application/MacOSXApplicationPathProvider.h
@@ -15,7 +15,6 @@ namespace Swift {
virtual boost::filesystem::path getHomeDir() const;
boost::filesystem::path getDataDir() const;
- virtual boost::filesystem::path getExecutableDir() const;
virtual std::vector<boost::filesystem::path> getResourceDirs() const {
return resourceDirs;
diff --git a/SwifTools/Application/UnixApplicationPathProvider.cpp b/SwifTools/Application/UnixApplicationPathProvider.cpp
index caffc50..c5a2782 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.cpp
+++ b/SwifTools/Application/UnixApplicationPathProvider.cpp
@@ -48,17 +48,4 @@ boost::filesystem::path UnixApplicationPathProvider::getDataDir() const {
return dataPath;
}
-boost::filesystem::path UnixApplicationPathProvider::getExecutableDir() const {
- ByteArray path;
- path.resize(4096);
- 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();
- }
-}
-
}
diff --git a/SwifTools/Application/UnixApplicationPathProvider.h b/SwifTools/Application/UnixApplicationPathProvider.h
index 2ef04ea..0c2f643 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.h
+++ b/SwifTools/Application/UnixApplicationPathProvider.h
@@ -21,7 +21,6 @@ namespace Swift {
virtual boost::filesystem::path getHomeDir() const;
boost::filesystem::path getDataDir() const;
- virtual boost::filesystem::path getExecutableDir() const;
virtual std::vector<boost::filesystem::path> getResourceDirs() const {
return resourceDirs;
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.cpp b/SwifTools/Application/WindowsApplicationPathProvider.cpp
index ed692d7..e19606f 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.cpp
+++ b/SwifTools/Application/WindowsApplicationPathProvider.cpp
@@ -17,11 +17,4 @@ WindowsApplicationPathProvider::WindowsApplicationPathProvider(const String& nam
resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
}
-boost::filesystem::path WindowsApplicationPathProvider::getExecutableDir() const {
- ByteArray data;
- data.resize(2048);
- GetModuleFileName(NULL, data.getData(), data.getSize());
- return boost::filesystem::path(data.toString().getUTF8Data()).parent_path();
-}
-
}
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.h b/SwifTools/Application/WindowsApplicationPathProvider.h
index b3341e3..26f7045 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.h
+++ b/SwifTools/Application/WindowsApplicationPathProvider.h
@@ -27,7 +27,6 @@ namespace Swift {
return boost::filesystem::path(homeDirRaw);
}
- virtual boost::filesystem::path getExecutableDir() const;
virtual std::vector<boost::filesystem::path> getResourceDirs() const {
return resourceDirs;
}