Commit 44bf99a7 authored by Albert Astals Cid's avatar Albert Astals Cid

Kill the concept of "base dir"

We are a library so having a "common configuration folder" does not really
make much sense at a library level, and even less if it's called .xpdf :D

Fixes bug 49448
parent bb091e38
......@@ -60,52 +60,6 @@
//------------------------------------------------------------------------
GooString *getHomeDir() {
#ifdef VMS
//---------- VMS ----------
return new GooString("SYS$LOGIN:");
#elif defined(__EMX__) || defined(_WIN32)
//---------- OS/2+EMX and Win32 ----------
char *s;
GooString *ret;
if ((s = getenv("HOME")))
ret = new GooString(s);
else
ret = new GooString(".");
return ret;
#elif defined(ACORN)
//---------- RISCOS ----------
return new GooString("@");
#elif defined(MACOS)
//---------- MacOS ----------
return new GooString(":");
#else
//---------- Unix ----------
char *s;
struct passwd *pw;
GooString *ret;
if ((s = getenv("HOME"))) {
ret = new GooString(s);
} else {
if ((s = getenv("USER")))
pw = getpwnam(s);
else
pw = getpwuid(getuid());
if (pw)
ret = new GooString(pw->pw_dir);
else
ret = new GooString(".");
}
return ret;
#endif
}
GooString *getCurrentDir() {
char buf[PATH_MAX+1];
......
......@@ -71,9 +71,6 @@ class GooString;
//------------------------------------------------------------------------
// Get home directory path.
extern GooString *getHomeDir();
// Get current directory.
extern GooString *getCurrentDir();
......
......@@ -354,9 +354,8 @@ cmsHPROFILE loadColorProfile(const char *fileName)
}
return hp;
}
// try to load from user directory
GooString *path = globalParams->getBaseDir();
path->append(COLOR_PROFILE_DIR);
// try to load from global directory
GooString *path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
path->append(fileName);
// check if open the file
if ((fp = fopen(path->getCString(),"r")) != NULL) {
......@@ -364,17 +363,6 @@ cmsHPROFILE loadColorProfile(const char *fileName)
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
if (hp == NULL) {
// load from global directory
path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
path->append(fileName);
// check if open the file
if ((fp = fopen(path->getCString(),"r")) != NULL) {
fclose(fp);
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
}
return hp;
}
......
......@@ -571,11 +571,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
}
#ifdef _WIN32
// baseDir will be set by a call to setBaseDir
baseDir = new GooString();
substFiles = new GooHash(gTrue);
#else
baseDir = appendToPath(getHomeDir(), ".xpdf");
#endif
nameToUnicode = new NameToCharCode();
cidToUnicodes = new GooHash(gTrue);
......@@ -797,7 +793,6 @@ GlobalParams::~GlobalParams() {
delete macRomanReverseMap;
delete baseDir;
delete nameToUnicode;
deleteGooHash(cidToUnicodes, GooString);
deleteGooHash(unicodeToUnicodes, GooString);
......@@ -846,13 +841,6 @@ GlobalParams::~GlobalParams() {
#endif
}
//------------------------------------------------------------------------
void GlobalParams::setBaseDir(const char *dir) {
delete baseDir;
baseDir = new GooString(dir);
}
//------------------------------------------------------------------------
// accessors
//------------------------------------------------------------------------
......@@ -862,15 +850,6 @@ CharCode GlobalParams::getMacRomanCharCode(char *charName) {
return macRomanReverseMap->lookup(charName);
}
GooString *GlobalParams::getBaseDir() {
GooString *s;
lockGlobalParams;
s = baseDir->copy();
unlockGlobalParams;
return s;
}
Unicode GlobalParams::mapNameToUnicode(const char *charName) {
// no need to lock - nameToUnicode is constant
return nameToUnicode->lookup(charName);
......
......@@ -133,14 +133,12 @@ public:
~GlobalParams();
void setBaseDir(const char *dir);
void setupBaseFonts(char *dir);
//----- accessors
CharCode getMacRomanCharCode(char *charName);
GooString *getBaseDir();
Unicode mapNameToUnicode(const char *charName);
UnicodeMap *getResidentUnicodeMap(GooString *encodingName);
FILE *getUnicodeMapFile(GooString *encodingName);
......@@ -273,7 +271,6 @@ private:
//----- user-modifiable settings
GooString *baseDir; // base directory - for plugins, etc.
NameToCharCode * // mapping from char name to Unicode
nameToUnicode;
GooHash *cidToUnicodes; // files for mappings from char collections
......
......@@ -1242,7 +1242,6 @@ int main(int argc, char **argv)
if (!globalParams)
return 1;
globalParams->setErrQuiet(gFalse);
globalParams->setBaseDir("");
FILE * outFile = NULL;
if (gOutFileName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment