From: Vladimir Risojevic |
Date: Thu Dec 4 22:24:29 2008 |
Subject: [greenstone-devel] cache\\_generated\\_images problem (and solution) |
Since I am currently maintaining a few collections which consist mainly of
scanned images, I welcome cache\_generated\_images option in Greenstone 2.81.
However, when I tried to build a collection with
cache\_generated\_images=true on a
WinXP machine I got the following error messages: Use of uninitialized
value in substitution (s///) at C:\\Program
Files\\Greenstone/perllib/plugins/BaseMediaConverter.pm line 84. and ****
Error is: fileparse(): need a valid pathname at C:\\Program
Files\\Greenstone/perllib/plugins/BaseMediaConverter.pm line 88.
I traced the problem to BaseMediaConverter.pm and found out that the first
message appears because regexp in line 84 cannot match $base\_dir because on
windows $base\_dir contains slashes as directory separators, while in
$filename
directory separators are backslashes. The second error message is merely a
consequence of the first one, because $file is empty.
In order to solve this either $base\_dir or $filename has to be fixed. I
couldn't
find where $self->{'base\_dir'} is set. It seems that it is not in line
67 of
BaseMediaConverter.pm since $base\_dir there is an empty string. In the
end (and
because it is very late night) I decided to use a quick and dirty
approach and
insert:
$filename =~ s/\\\\/\\//g;
before the regexp in line 84 and fix the $filename. This solved the
problem, and
I hope it will be helpful to others.
Maybe a better way to solve this problem would be to construct
$self->{'base\_dir'} with backslashes or slashes depending on the operating
system, as utils::filename\_cat does. However, as I said I cannot find
where it
is defined.
Best regards,
Vladimir
--
Vladimir Risojevic
Teaching Assistant
Faculty of Electrical Engineering
University of Banjaluka
Patre 5
78000 Banjaluka
Bosnia and Herzegovina
Phone: +387 51 221 847, +387 51 221 876
Fax: +387 51 211 408
Email: vlado@etfbl.net
WWW: http://www.etfbl.net