}
}
+static GString* qualify_filename(GString*path, GString*filename)
+{
+ GString*fullpath = 0;
+ char*prefix = "/usr/local/share/xpdf/";
+
+ if (filename->getChar(0) != '\\' && filename->getChar(0) != '/') {
+ /* relative path */
+ fullpath = path->copy();
+ fullpath->append(filename);
+ } else if (!strncmp(filename->getCString(), prefix, strlen(prefix))) {
+ /* xpdf default path */
+ char*s = strchr(filename->getCString()+strlen(prefix), '/');
+ if(s) {
+ fullpath = path->copy();
+ fullpath->append(s+1);
+ } else {
+ fullpath = filename->copy();
+ }
+ } else {
+ /* absolute path */
+ fullpath = filename->copy();
+ }
+ //printf("%s -%s-> %s\n", filename->getCString(), path->getCString(), fullpath->getCString());
+ return fullpath;
+}
+
void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
int line) {
GString *name;
fileName->getCString(), line);
return;
}
- name = (GString *)tokens->get(1);
+ name = qualify_filename(this->path, (GString *)tokens->get(1));
if (!(f = fopen(name->getCString(), "r"))) {
error(-1, "Couldn't open 'nameToUnicode' file '%s'",
name->getCString());
fclose(f);
}
-static GString* qualify_filename(GString*path, GString*filename)
-{
- GString*fullpath = 0;
- char*prefix = "/usr/local/share/xpdf/";
-
- if (filename->getChar(0) != '\\' && filename->getChar(0) != '/') {
- /* relative path */
- fullpath = path->copy();
- fullpath->append(filename);
- } else if (!strncmp(filename->getCString(), prefix, strlen(prefix))) {
- /* xpdf default path */
- char*s = strchr(filename->getCString()+strlen(prefix), '/');
- if(s) {
- fullpath = path->copy();
- fullpath->append(s+1);
- } else {
- fullpath = filename->copy();
- }
- } else {
- /* absolute path */
- fullpath = filename->copy();
- }
- printf("%s -%s-> %s\n", filename->getCString(), path->getCString(), fullpath->getCString());
- return fullpath;
-}
-
void GlobalParams::parseCIDToUnicode(GList *tokens, GString *fileName,
int line) {
GString *collection, *name, *old;