X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fgetter%2Fhttp_getter_map.ml;h=2b61e79761c008568d9552c240cb521667e8b705;hb=0c6a5aadb1a7746681a8e26fc0b009f847c10557;hp=1b5d209d330a2ea8593830ffe530e6ce5d65314f;hpb=0224ce3e20ff502b7ce04865bc23ed99a47c764d;p=helm.git diff --git a/helm/ocaml/getter/http_getter_map.ml b/helm/ocaml/getter/http_getter_map.ml index 1b5d209d3..2b61e7976 100644 --- a/helm/ocaml/getter/http_getter_map.ml +++ b/helm/ocaml/getter/http_getter_map.ml @@ -46,7 +46,9 @@ class map dbname = theory:/path/t.theory into theory:/path/t/index.theory when cic:/path/t/ exists *) method private normalize_key key = - if Pcre.pmatch ~rex:index_RE key then + if Pcre.pmatch ~rex:index_RE key && + (try ignore (Dbm.find db key); false with Not_found -> true) + then (* we substitute /index.theory with .theory *) String.sub key 0 (String.length key - 13) ^ ".theory" else key @@ -54,19 +56,19 @@ class map dbname = method add key value = self#doWriter (lazy ( try - Dbm.add db (self#normalize_key key) value + Dbm.add db key value with Dbm.Dbm_error "Entry already exists" -> raise (Key_already_in key) )) method replace key value = self#doWriter (lazy ( - Dbm.replace db (self#normalize_key key) value + Dbm.replace db key value )) method remove key = self#doWriter (lazy ( try - Dbm.remove db (self#normalize_key key) + Dbm.remove db key with Dbm.Dbm_error "dbm_delete" -> raise (Key_not_found key) ))