let read file =
try
if Sys.file_exists file then
let chanin = open_in file in
let l = input_line chanin in
let reader =
try List.assoc l readers
with Not_found ->
(** let's try with the old input value reader *) |
(fun chanin ->
seek_in chanin 0;
V1.read chanin
)
in
try
let f = reader chanin in
close_in chanin;
f
with e ->
close_in chanin ;
raise e
else
(
let f = Current.default () in
write file f;
f
)
with
Sys_error s ->
raise (Failure s)
| End_of_file ->
Current.default ()