X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fgetter%2Fhttp_getter.ml;h=6192cacdccea8f264e0fa48bc1d26b649d3019cf;hb=d09e006a81595572f00eb0de7f1e954b6e20f66a;hp=83dbc0e8c957966b8ea59fd10fa63527f4de75fc;hpb=f82bff515257cee1dd485b251763ea4a8d5ca0e2;p=helm.git diff --git a/helm/ocaml/getter/http_getter.ml b/helm/ocaml/getter/http_getter.ml index 83dbc0e8c..6192cacdc 100644 --- a/helm/ocaml/getter/http_getter.ml +++ b/helm/ocaml/getter/http_getter.ml @@ -394,10 +394,11 @@ let ls = "^([^.]*\\.[^.]*)((\\.body)|(\\.proof_tree)|(\\.types))?(\\.ann)?$" in let (types_RE, types_ann_RE, body_RE, body_ann_RE, - proof_tree_RE, proof_tree_ann_RE) = + proof_tree_RE, proof_tree_ann_RE, trailing_slash_RE) = (Pcre.regexp "\\.types$", Pcre.regexp "\\.types\\.ann$", Pcre.regexp "\\.body$", Pcre.regexp "\\.body\\.ann$", - Pcre.regexp "\\.proof_tree$", Pcre.regexp "\\.proof_tree\\.ann$") + Pcre.regexp "\\.proof_tree$", Pcre.regexp "\\.proof_tree\\.ann$", + Pcre.regexp "/$") in let (slash_RE, til_slash_RE, no_slashes_RE) = (Pcre.regexp "/", Pcre.regexp "^.*/", Pcre.regexp "^[^/]*$") @@ -406,10 +407,8 @@ let ls = if remote () then ls_remote regexp else begin - let pat = - "^" ^ regexp -(* (match lsuri with Cic p -> ("cic:" ^ p) | Theory p -> ("theory:" ^ p)) *) - in + let looking_for_dir = Pcre.pmatch ~rex:trailing_slash_RE regexp in + let pat = Pcre.replace ~rex:trailing_slash_RE ("^" ^ regexp) in let (dir_RE, obj_RE) = (Pcre.regexp (pat ^ "/"), Pcre.regexp (pat ^ "(\\.|$)")) in @@ -443,13 +442,15 @@ let ls = (* BLEARGH Dbm module lacks support for fold-like functions *) (fun key _ -> match key with - | uri when Pcre.pmatch ~rex:dir_RE uri -> (* directory hit *) + | uri when looking_for_dir && Pcre.pmatch ~rex:dir_RE uri -> + (* directory hit *) let localpart = Pcre.replace ~rex:dir_RE uri in if Pcre.pmatch ~rex:no_slashes_RE localpart then store_obj localpart else store_dir localpart - | uri when Pcre.pmatch ~rex:obj_RE uri -> (* file hit *) + | uri when (not looking_for_dir) && Pcre.pmatch ~rex:obj_RE uri -> + (* file hit *) store_obj (Pcre.replace ~rex:til_slash_RE uri) | uri -> () (* miss *)); let ls_items = ref [] in