Skip to content
Snippets Groups Projects
Commit 7b04e7b9 authored by Jens Steidl's avatar Jens Steidl :baby_chick:
Browse files

- reactor: removed getFileName(), broken on Windows, not needed (we aleady...

- reactor: removed getFileName(), broken on Windows, not needed (we aleady have File::Basename or Path::Tiny for basename)
parent ca895918
No related branches found
No related tags found
No related merge requests found
...@@ -374,11 +374,11 @@ PATCH ...@@ -374,11 +374,11 @@ PATCH
my $i = 1; my $i = 1;
foreach my $file(@addMetaFile){ foreach my $file(@addMetaFile){
# check reserved file names # check reserved file names
my $meta_file_name = getFileName($file); my $meta_file_name = basename($file);
if($meta_file_name eq "rights.xml" || $meta_file_name eq "mods.xml"){ if($meta_file_name eq "rights.xml" || $meta_file_name eq "mods.xml"){
foreach my $f(@addMetaFile){ foreach my $f(@addMetaFile){
# check if numbered xml file exists # check if numbered xml file exists
my $f_name = getFileName($f); my $f_name = basename($f);
while($f_name eq "$i.xml"){ while($f_name eq "$i.xml"){
$i++; $i++;
} }
...@@ -410,28 +410,14 @@ PATCH ...@@ -410,28 +410,14 @@ PATCH
} }
} }
sub getFileName($){
if(! defined $_[0]) { croak "path with file name is not defined!"; }
if($_[0] eq ""){ croak "invalid parameters!"; }
my $file_name = $_[0];
# grep last directory from a path
if ($file_name =~ m/([^\/]+)$/){
$file_name = $1;
}
return $file_name;
}
sub validateRightsXML($$){ sub validateRightsXML($$){
if(! defined $_[0]) { croak "rightsFilePath not defined!"; } if(! $_[0]) { croak "rightsFilePath not defined!"; }
if(! defined $_[1]) { croak "xsd name not defined!"; } if(! defined $_[1]) { croak "xsd name not defined!"; }
my $rightsFilePath = $_[0]; my $rightsFilePath = $_[0];
my $xsdName = $_[1]; my $xsdName = $_[1];
my $rightsName = getFileName($rightsFilePath); my $rightsName = basename($rightsFilePath);
my $xsd_file = path(__FILE__)->parent->realpath->parent->child("xsd")->child($xsdName); # absolute path my $xsd_file = path(__FILE__)->parent->realpath->parent->child("xsd")->child($xsdName); # absolute path
my $schema = XML::LibXML::Schema->new(location => $xsd_file); my $schema = XML::LibXML::Schema->new(location => $xsd_file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment