Txt pull puts peer texts in $txtdir/peers
git-svn-id: file:///srv/svn/repo/kosuzu/trunk@16 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
@@ -3,12 +3,10 @@ type item_t = t list
|
|||||||
type record_t = Text.t * item_t
|
type record_t = Text.t * item_t
|
||||||
|
|
||||||
let extension = ".txt"
|
let extension = ".txt"
|
||||||
let def_dir () =
|
let def_dir () = try Sys.getenv "txtdir" with Not_found ->
|
||||||
let share = Sys.getenv "HOME" ^ "/.local/share/texts/" in
|
let share = Filename.concat (Sys.getenv "HOME") ".local/share/texts/" in
|
||||||
try Sys.getenv "txtdir" with Not_found ->
|
match Sys.is_directory share with true -> share
|
||||||
match Sys.is_directory share with
|
| false | exception (Sys_error _) -> "."
|
||||||
| true -> share
|
|
||||||
| false | exception (Sys_error _) -> "."
|
|
||||||
|
|
||||||
let to_string f =
|
let to_string f =
|
||||||
let ic = open_in f in
|
let ic = open_in f in
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
let text_dir = Filename.concat (Sys.getenv "HOME") ".local/share/texts"
|
let text_dir = Filename.concat (File_store.def_dir ()) "peers"
|
||||||
|
|
||||||
let fold fn init = match Sys.readdir text_dir with
|
let fold fn init = match Sys.readdir text_dir with
|
||||||
| exception (Sys_error msg) -> prerr_endline msg
|
| exception (Sys_error msg) -> prerr_endline msg
|
||||||
|
|||||||
Reference in New Issue
Block a user