Last change
on this file since 20 was 16, checked in by fox, 3 years ago |
Txt pull puts peer texts in $txtdir/peers
|
File size:
775 bytes
|
Line | |
---|
1 | let text_dir = Filename.concat (File_store.def_dir ()) "peers"
|
---|
2 |
|
---|
3 | let fold fn init = match Sys.readdir text_dir with
|
---|
4 | | exception (Sys_error msg) -> prerr_endline msg
|
---|
5 | | dirs ->
|
---|
6 | let read_pack path =
|
---|
7 | let pack_path = Filename.(concat text_dir @@ concat path "index.pck") in
|
---|
8 | match Sys.file_exists pack_path with false -> () | true ->
|
---|
9 | match Header_pack.of_string (File_store.to_string pack_path) with
|
---|
10 | | Error s -> Printf.eprintf "%s %s\n" s pack_path
|
---|
11 | | Ok p -> ignore @@ List.fold_left fn init Header_pack.(p.info.locations)
|
---|
12 | in
|
---|
13 | Array.iter read_pack dirs
|
---|
14 |
|
---|
15 | let scheme url =
|
---|
16 | let colon_idx = String.index_from url 0 ':' in
|
---|
17 | let scheme = String.sub url 0 colon_idx in
|
---|
18 | (* let remain = String.(sub url (colon_idx+1) (length url - length scheme - 1)) in*)
|
---|
19 | scheme
|
---|
Note:
See
TracBrowser
for help on using the repository browser.