- (* innertypes *)
- let innertypesuri = UriManager.innertypesuri_of_uri uri in
- Xml.pp ~quiet:true xmlinnertypes (Some (path ^ ".types.xml")) ;
- Http_getter.register' innertypesuri
- (Helm_registry.get "local_library.url" ^
- Str.replace_first (Str.regexp "^cic:") ""
- (UriManager.string_of_uri innertypesuri) ^ ".xml"
- ) ;
- (* constant type / variable / mutual inductive types definition *)
- Xml.pp ~quiet:true xml (Some (path ^ ".xml")) ;
- Http_getter.register' uri
- (Helm_registry.get "local_library.url" ^
- Str.replace_first (Str.regexp "^cic:") ""
- (UriManager.string_of_uri uri) ^ ".xml"
- ) ;
- match bodyxml with
- None -> ()
- | Some bodyxml' ->
- (* constant body *)
- let bodyuri =
- match UriManager.bodyuri_of_uri uri with
- None -> assert false
- | Some bodyuri -> bodyuri
- in
- Xml.pp ~quiet:true bodyxml' (Some (path ^ ".body.xml")) ;
- Http_getter.register' bodyuri
- (Helm_registry.get "local_library.url" ^
- Str.replace_first (Str.regexp "^cic:") ""
- (UriManager.string_of_uri bodyuri) ^ ".xml"
- )
+
+ (* prepare URIs and paths *)
+ let innertypesuri = UriManager.innertypesuri_of_uri uri in
+ let bodyuri = UriManager.bodyuri_of_uri uri in
+ let innertypesfilename = Str.replace_first (Str.regexp "^cic:") ""
+ (UriManager.string_of_uri innertypesuri) ^ ".xml" in
+ let innertypespath = !basedir ^ "/" ^ innertypesfilename in
+ let xmlfilename = Str.replace_first (Str.regexp "^cic:") ""
+ (UriManager.string_of_uri uri) ^ ".xml" in
+ let xmlpath = !basedir ^ "/" ^ xmlfilename in
+ let xmlbodyfilename = Str.replace_first (Str.regexp "^cic:") ""
+ (UriManager.string_of_uri uri) ^ ".body.xml" in
+ let xmlbodypath = !basedir ^ "/" ^ xmlbodyfilename in
+ let path_scheme_of path = "file:/" ^ path in
+
+ (* now write to disk *)
+ Xml.pp ~quiet:true xmlinnertypes (Some innertypespath) ;
+ Xml.pp ~quiet:true xml (Some xmlpath) ;
+
+ (* now register to the getter *)
+ Http_getter.register' innertypesuri (path_scheme_of innertypespath);
+ Http_getter.register' uri (path_scheme_of xmlpath);
+
+ (* now the optional body, both write and register *)
+ (match bodyxml,bodyuri with
+ None,None -> ()
+ | Some bodyxml,Some bodyuri->
+ Xml.pp ~quiet:true bodyxml (Some xmlbodypath) ;
+ Http_getter.register' bodyuri (path_scheme_of xmlbodypath)
+ | _-> assert false)