summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-23 17:06:06 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-12-23 18:02:26 (GMT)
commit3e73c64177d088d49bd3577de4f982c5928c1f55 (patch)
treea033e6a53cd2748bf959a8f83c1f3d79eeff0a57
parent5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2 (diff)
downloadswift-3e73c64177d088d49bd3577de4f982c5928c1f55.zip
swift-3e73c64177d088d49bd3577de4f982c5928c1f55.tar.bz2
Assert when APPDATA or USERPROFILE is null.
This seems to sometimes happen in our CI builds. This should make it easier to at least detect that this is the case. Change-Id: Iab59bbc10a14e350df9ef240c8a862ce8ea68794
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.cpp17
-rw-r--r--SwifTools/Application/WindowsApplicationPathProvider.h15
2 files changed, 19 insertions, 13 deletions
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.cpp b/SwifTools/Application/WindowsApplicationPathProvider.cpp
index 8514fa7..730a57a 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.cpp
+++ b/SwifTools/Application/WindowsApplicationPathProvider.cpp
@@ -7,6 +7,7 @@
#include <SwifTools/Application/WindowsApplicationPathProvider.h>
#include <windows.h>
+#include <cassert>
namespace Swift {
@@ -15,4 +16,20 @@ WindowsApplicationPathProvider::WindowsApplicationPathProvider(const std::string
resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
}
+boost::filesystem::path WindowsApplicationPathProvider::getDataDir() const {
+ char* appDirRaw = getenv("APPDATA");
+ assert(appDirRaw);
+ boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName());
+ boost::filesystem::create_directory(result);
+ return result;
+}
+
+boost::filesystem::path WindowsApplicationPathProvider::getHomeDir() const {
+ //FIXME: This should be My Documents
+ char* homeDirRaw = getenv("USERPROFILE");
+ assert(homeDirRaw);
+ return boost::filesystem::path(homeDirRaw);
+}
+
+
}
diff --git a/SwifTools/Application/WindowsApplicationPathProvider.h b/SwifTools/Application/WindowsApplicationPathProvider.h
index f288326..a4e8668 100644
--- a/SwifTools/Application/WindowsApplicationPathProvider.h
+++ b/SwifTools/Application/WindowsApplicationPathProvider.h
@@ -13,19 +13,8 @@ namespace Swift {
public:
WindowsApplicationPathProvider(const std::string& name);
- boost::filesystem::path getDataDir() const {
- char* appDirRaw = getenv("APPDATA");
- boost::filesystem::path result(boost::filesystem::path(appDirRaw) / getApplicationName());
- boost::filesystem::create_directory(result);
- return result;
- }
-
- boost::filesystem::path getHomeDir() const {
- //FIXME: This should be My Documents
-
- char* homeDirRaw = getenv("USERPROFILE");
- return boost::filesystem::path(homeDirRaw);
- }
+ boost::filesystem::path getDataDir() const;
+ boost::filesystem::path getHomeDir() const;
virtual std::vector<boost::filesystem::path> getResourceDirs() const {
return resourceDirs;