added a check for data and user data paths being the same

This commit is contained in:
Mark Vejvoda
2013-11-06 00:31:36 +00:00
parent e689ac8bff
commit 70421d1b3d
7 changed files with 70 additions and 39 deletions

View File

@@ -28,12 +28,6 @@
#endif
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#endif
#include "utf8.h"
#include "font.h"
#include "string_utils.h"
@@ -177,21 +171,6 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
#endif
}
string getUserHomeFromGLIBC() {
string home_folder = "";
const char *homedir = getenv("HOME");
if (!homedir) {
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
struct passwd *pw = getpwuid(getuid());
homedir = pw->pw_dir;
#else
homedir = "";
#endif
}
home_folder = homedir;
return home_folder;
}
std::map<string,string> Properties::getTagReplacementValues(std::map<string,string> *mapExtraTagReplacementValues) {
std::map<string,string> mapTagReplacementValues;
@@ -202,7 +181,7 @@ std::map<string,string> Properties::getTagReplacementValues(std::map<string,stri
#ifdef WIN32
const char *homeDir = getenv("USERPROFILE");
#else
string home = getUserHomeFromGLIBC();
string home = getUserHome();
const char *homeDir = home.c_str();
#endif
@@ -304,7 +283,7 @@ bool Properties::applyTagsToValue(string &value, const std::map<string,string> *
#ifdef WIN32
const char *homeDir = getenv("USERPROFILE");
#else
string home = getUserHomeFromGLIBC();
string home = getUserHome();
const char *homeDir = home.c_str();
#endif