diff --git a/aegisub/libaegisub/Makefile b/aegisub/libaegisub/Makefile
index daf6859032b3d541a01d51951b5f68d652285f2e..b7b85465a06cf3b6a9f024414994887f8bb07755 100644
--- a/aegisub/libaegisub/Makefile
+++ b/aegisub/libaegisub/Makefile
@@ -17,7 +17,7 @@ LDFLAGS += -L../universalchardet -luniversalchardet
 endif
 
 common/charset_conv.o: CXXFLAGS += $(CFLAGS_ICONV)
-unix/path.o: CXXFLAGS += -DDIR_DATA=\"$(P_DATA)\" -DDIR_DOC=\"$(P_DOC)\"
+unix/path.o: CXXFLAGS += -DP_DATA=\"$(P_DATA)\" -DP_DOC=\"$(P_DOC)\" -DP_LOCALE=\"$(P_LOCALE)\"
 
 SRC = \
 	common/charset.cpp \
diff --git a/aegisub/libaegisub/unix/path.cpp b/aegisub/libaegisub/unix/path.cpp
index 9e76ee08ab22a3db9b7136e7c1124235ff82901b..f863717ea5b849e6dd03b17e2a6de35edf52c9b6 100644
--- a/aegisub/libaegisub/unix/path.cpp
+++ b/aegisub/libaegisub/unix/path.cpp
@@ -22,6 +22,9 @@
 #include "config.h"
 
 #ifndef LAGI_PRE
+#include <stdio.h>
+#include <stdlib.h>
+
 #include <string>
 #endif
 
@@ -30,26 +33,40 @@
 
 namespace agi {
 
+
+const std::string home() {
+	char *ehome;
+	ehome = getenv("HOME");
+	if (ehome == NULL) {
+		//XXX: explode here.
+	}
+	std::string home(ehome);
+	free(ehome);
+	return home;
+}
+
+
 const std::string Path::Data() {
-	return DIR_DATA;
+	return P_DATA;
 }
 
 const std::string Path::Doc() {
-	return DIR_DOC;
+	return P_DOC;
 }
 
 const std::string Path::User() {
-	return "~/";
+	return home();
 }
 
 const std::string Path::Locale() {
-	std::string tmp("~/.aegisub-");
-	return tmp.append(AEGISUB_VERSION_DATA);
+	return P_LOCALE;
 }
 
 const std::string Path::Config() {
-	std::string tmp("~/.aegisub-");
-	return tmp.append(AEGISUB_VERSION_DATA);
+	std::string tmp(home());
+	tmp.append("/.aegisub-");
+	tmp.append(AEGISUB_VERSION_DATA);
+	return tmp.append("/");
 }
 
 const std::string Path::Temp() {