my ($uri,$localpart,$basepart,$dirname,$suffix,$flags,$key);
my (@itemz,@already_pushed_dir);
my (%objects,%dirs); # map uris to suffixes' flags
+ #my $debug=1; # for debug
print "FINDURIS, uritype: $uritype, uripattern: $uripattern, ".
- "format: $format\n\n";
+ "format: $format\n\n" if defined($debug);
if (($uritype eq "cic") or ($uritype eq "theory")) {
# get info only of one type: cic or theory
foreach (keys(%map)) { # select matching uris
$uri = $_;
- if ($uri =~ /^$uritype:$uripattern\//) {
- $localpart = $uri;
- $localpart =~ s/^$uritype:$uripattern\/(.*)/$1/;
+ if ($uri =~ /^$uritype:$uripattern(\/|$|\.)/) {
+ if ($uri =~ /^$uritype:$uripattern\//) { # directory match
+ $localpart = $uri;
+ $localpart =~ s/^$uritype:$uripattern\/(.*)/$1/;
+ } elsif ($uri =~ /^$uritype:$uripattern($|\.)/) { # file match
+ $localpart = $uri;
+ $localpart =~ s/^.*\/([^\/]*)/$1/;
+ } else {
+ die "Internal error, seems that requested match is none of ".
+ "directory match or file match";
+ }
+ print "LOCALPART: $localpart\n" if defined($debug);
if ($localpart =~ /^[^\/]*$/) { # no slash, an OBJECT
$basepart = $localpart;
- $basepart =~ s/^([^.]*\.[^.]*)(\.types)?(\.ann)?/$1/; # remove exts .types or
+ $basepart =~ s/^([^.]*\.[^.]*)(\.types)?(\.ann)?/$1/;
+ # remove exts .types or
# .types.ann
$flags = $objects{$basepart}; # get old flags
if ($localpart =~ /\.ann$/) {