kosuzu/lib/peers.ml
fox a89196679a Moved conversion file, conf -> pack, fixes
Conversion:
- Configuration sought in: txt.conf, ~/.config/txt/txt.conf
- logarion.conf to produce index and target formats

Publication:
- `publish <ids>`: copies txt with ID into Pubdir/public_{html,gemini,gopher} (Pubdir fromtxt.conf), if dirs exist, and runs `convert <pubdir>`

Fixes:
- Feed <nav> regression

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@21 eb64cd80-c68d-6f47-b6a3-0ada418499da
2022-11-01 17:11:09 +00:00

20 lines
774 B
OCaml

let text_dir = Filename.concat (File_store.txtdir ()) "peers"
let fold fn init = match Sys.readdir text_dir with
| exception (Sys_error msg) -> prerr_endline msg
| dirs ->
let read_pack path =
let pack_path = Filename.(concat text_dir @@ concat path "index.pck") in
match Sys.file_exists pack_path with false -> () | true ->
match Header_pack.of_string (File_store.to_string pack_path) with
| Error s -> Printf.eprintf "%s %s\n" s pack_path
| Ok p -> ignore @@ List.fold_left fn init Header_pack.(p.info.locations)
in
Array.iter read_pack dirs
let scheme url =
let colon_idx = String.index_from url 0 ':' in
let scheme = String.sub url 0 colon_idx in
(* let remain = String.(sub url (colon_idx+1) (length url - length scheme - 1)) in*)
scheme