]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaclean.ml
added cleaning of .lexicon and .metadata files
[helm.git] / helm / matita / matitaclean.ml
index a5669d2e62d94acd4d8012b2784a64d981fd5c77..826a4a2822abb4301c9ad10b9d83089fb32ca030 100644 (file)
  * 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);