mirror of
https://github.com/glest/glest-source.git
synced 2025-08-30 11:19:48 +02:00
added a check for data and user data paths being the same
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user