summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2012-05-10 22:59:18 +0200
committerAlbert Astals Cid <aacid@kde.org>2012-05-10 23:00:14 +0200
commit44bf99a7b8683a077f2a5db50541099c109aa069 (patch)
treec5ff0e474ed69c50794b77616d3d76d3f755fa5f
parentbb091e38a1c0248ba24b0711b4afc0b0524cce10 (diff)
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
-rw-r--r--goo/gfile.cc46
-rw-r--r--goo/gfile.h3
-rw-r--r--poppler/GfxState.cc16
-rw-r--r--poppler/GlobalParams.cc21
-rw-r--r--poppler/GlobalParams.h3
-rw-r--r--test/perf-test.cc1
6 files changed, 2 insertions, 88 deletions
diff --git a/goo/gfile.cc b/goo/gfile.cc
index 1351de75..47d792b9 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -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];
diff --git a/goo/gfile.h b/goo/gfile.h
index 1eef058c..be4be7ac 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -71,9 +71,6 @@ class GooString;
//------------------------------------------------------------------------
-// Get home directory path.
-extern GooString *getHomeDir();
-
// Get current directory.
extern GooString *getCurrentDir();
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 5962fcbe..f6fa5d07 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -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;
}
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 64d6133c..5fefda9b 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -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);
@@ -847,13 +842,6 @@ GlobalParams::~GlobalParams() {
}
//------------------------------------------------------------------------
-
-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);
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 375ac2cc..a9637ce9 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -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
diff --git a/test/perf-test.cc b/test/perf-test.cc
index 6bdda97d..21fbdeed 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -1242,7 +1242,6 @@ int main(int argc, char **argv)
if (!globalParams)
return 1;
globalParams->setErrQuiet(gFalse);
- globalParams->setBaseDir("");
FILE * outFile = NULL;
if (gOutFileName) {