* Instead of ~ use getenv("HOME") to get the users home directory.

* Fix Locale() to return P_LOCALE
 * Change data and doc values to P_DATA and P_DOC.

Originally committed to SVN as r5322.
This commit is contained in:
Amar Takhar 2011-02-08 04:22:52 +00:00
parent 961c1245f7
commit 355ad91105
2 changed files with 25 additions and 8 deletions

View File

@ -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 \

View File

@ -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() {