X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2Fmatitaclean.ml;h=826a4a2822abb4301c9ad10b9d83089fb32ca030;hb=a8d3be41b60e0720b32750243c1999c5083f4299;hp=a5669d2e62d94acd4d8012b2784a64d981fd5c77;hpb=7b995596c8b11be95c430646227d01928cc71219;p=helm.git diff --git a/helm/matita/matitaclean.ml b/helm/matita/matitaclean.ml index a5669d2e6..826a4a282 100644 --- a/helm/matita/matitaclean.ml +++ b/helm/matita/matitaclean.ml @@ -23,11 +23,15 @@ * http://helm.cs.unibo.it/ *) +(* $Id$ *) + open Printf module UM = UriManager module TA = GrafiteAst +let clean_suffixes = [ ".moo"; ".lexicon"; ".metadata"; ".xml.gz" ] + let main () = let _ = MatitaInit.initialize_all () in let basedir = Helm_registry.get "matita.basedir" in @@ -35,11 +39,13 @@ let main () = | [ "all" ] -> LibraryDb.clean_owner_environment (); let xmldir = basedir ^ "/xml" in - ignore - (Sys.command - ("find " ^ xmldir ^ - " \\( -name \\*.xml.gz -o -name \\*.moo \\) " ^ - "-exec rm \\{\\} \\; 2> /dev/null")); + let clean_pat = + String.concat " -o " + (List.map (fun suf -> "-name \\*" ^ suf) clean_suffixes) in + let clean_cmd = + sprintf "find %s \\( %s \\) -exec rm \\{\\} \\; 2> /dev/null" + xmldir clean_pat in + ignore (Sys.command clean_cmd); ignore (Sys.command ("find " ^ xmldir ^ " -type d -exec rmdir -p {} \\; 2> /dev/null")); @@ -54,7 +60,7 @@ let main () = UM.buri_of_uri (UM.uri_of_string suri) with UM.IllFormedUri _ -> let u = - GrafiteParserMisc.baseuri_of_script ~include_paths:[] suri in + DependenciesParser.baseuri_of_script ~include_paths:[] suri in if String.length u < 5 || String.sub u 0 5 <> "cic:/" then begin HLog.error (sprintf "File %s defines a bad baseuri: %s" suri u);