nixpkgs/pkgs/development/libraries/poppler/datadir_env.patch

57 lines
1.8 KiB
Diff
Raw Normal View History

diff -ur poppler-0.6.1/poppler/GlobalParams.cc poppler-0.6.1-patched/poppler/GlobalParams.cc
--- poppler-0.6.1/poppler/GlobalParams.cc 2007-09-17 20:37:58.000000000 +0200
+++ poppler-0.6.1-patched/poppler/GlobalParams.cc 2007-11-06 16:11:55.995595933 +0100
@@ -654,27 +654,39 @@
GDir *dir;
GDirEntry *entry;
- dir = new GDir(POPPLER_DATADIR "/nameToUnicode", gFalse);
+ GooString *real_datadir = new GooString (getenv("POPPLER_DATADIR"));
+ if (!real_datadir->getCString())
+ real_datadir->Set(POPPLER_DATADIR);
+ GooString *dirname;
+
+ dirname = real_datadir->copy();
+ dir = new GDir(dirname->append("/nameToUnicode")->getCString(), gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
parseNameToUnicode(entry->getFullPath());
delete entry;
}
delete dir;
+ delete dirname;
- dir = new GDir(POPPLER_DATADIR "/cidToUnicode", gFalse);
+ dirname = real_datadir->copy();
+ dir = new GDir(dirname->append("/cidToUnicode")->getCString(), gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
addCIDToUnicode(entry->getName(), entry->getFullPath());
delete entry;
}
delete dir;
+ delete dirname;
- dir = new GDir(POPPLER_DATADIR "/unicodeMap", gFalse);
+ dirname = real_datadir->copy();
+ dir = new GDir(dirname->append("/unicodeMap")->getCString(), gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
addUnicodeMap(entry->getName(), entry->getFullPath());
delete entry;
}
delete dir;
+ delete dirname;
+ dirname = real_datadir->copy();
dir = new GDir(POPPLER_DATADIR "/cMap", gFalse);
while (entry = dir->getNextEntry(), entry != NULL) {
addCMapDir(entry->getName(), entry->getFullPath());
@@ -682,6 +694,9 @@
delete entry;
}
delete dir;
+ delete dirname;
+
+ delete real_datadir;
}
void GlobalParams::parseNameToUnicode(GooString *name) {