]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/http_getter/http_getter.pl.in
- added support for file ls (i.e. you can use a baseuri that point to a
[helm.git] / helm / http_getter / http_getter.pl.in
index e301963bcf65af3225a866a54c5a82306fc4cfdd..924ddbb1930e966ef1c810e5f1633d597e31ca44 100755 (executable)
@@ -311,21 +311,32 @@ sub finduris { # find uris for cic and theory trees generation
  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$/) {