X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fgetter%2Fhttp_getter_misc.ml;h=b7b52bbf64309da80028b1b5cfd47fff7c31c615;hb=97c2d258a5c524eb5c4b85208899d80751a2c82f;hp=0430c1b48d3cf96856499f9e3fe418c801cc022a;hpb=a83e0e4b2cf4d0cd378b5f2f451aa857507e0a01;p=helm.git diff --git a/helm/ocaml/getter/http_getter_misc.ml b/helm/ocaml/getter/http_getter_misc.ml index 0430c1b48..b7b52bbf6 100644 --- a/helm/ocaml/getter/http_getter_misc.ml +++ b/helm/ocaml/getter/http_getter_misc.ml @@ -294,3 +294,20 @@ let extension s = String.sub s idx (String.length s - idx) with Not_found -> "" +let temp_file_of_uri uri = + let flat_string s s' c = + let cs = String.copy s in + for i = 0 to (String.length s) - 1 do + if String.contains s' s.[i] then cs.[i] <- c + done; + cs + in + let user = try Unix.getlogin () with _ -> "" in + Filename.open_temp_file (user ^ flat_string uri ".-=:;!?/&" '_') "" + +let backtick cmd = + let ic = Unix.open_process_in cmd in + let res = input_line ic in + ignore (Unix.close_process_in ic); + res +