[poppler] POPPLER_DATADIR
Adam Batkin
adam at batkin.net
Sun Apr 6 13:56:11 PDT 2008
Okay, here's a first stab at a patch to make the POPPLER_DATADIR
slightly more configurable.
By default, it will act exactly the same (configure's datarootdir).
I've modified the GlobalParams constructor to take an optional (defaults
to POPPLER_DATADIR) char* which it will pass along to
scanEncodingDirs(). To support this, I added an additional constructor
to GDir which takes a second char*, concatenating the two together with
the appropriate slash if necessary.
I then modified the qt4 backend (since that is what I'm most familiar
with) to actually use the new parameter:
- If the application does nothing differently, then the location can be
overridden with an environment variable POPPLER_DATADIR
- Otherwise, the application can call Poppler::configurePoppler() and
pass a char* pointing to a directory that it would like to be used as
the data directory (which can also be overridden by the environment
variable).
* This method also bypasses the static DocumentData::count reference
counting for the GlobalParams object, making the library slightly more
thread-safe
* This is also a slight performance enhancement as the GlobalParams
object won't get destroyed and recreated if you create and destroy
documents one-at-a-time
* And if you want to manually cleanup the GlobalParams, just call
Poppler::unconfigurePoppler().
I'm sure it's not perfect, but I thought I'd get some comments, make
sure I was heading down a reasonable path, etc...
-Adam Batkin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poppler-config.diff
Type: text/x-patch
Size: 7183 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20080406/1f68db5d/attachment.bin
More information about the poppler
mailing list