Skip to content

Commit

Permalink
uncompress-tlog supports both .tlf and .tlc
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Slootmaekers committed Feb 3, 2011
1 parent c255033 commit ccc998f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Binary file added data/005.tlc
Binary file not shown.
23 changes: 19 additions & 4 deletions src/main.ml
Expand Up @@ -132,10 +132,25 @@ let compress_tlog tlu =
Unix.unlink tlu;
Lwt_main.run t;0

let uncompress_tlog tlf =
let tlu = Tlc2.to_tlog_name tlf in
let t = Compression.uncompress_tlog tlf tlu in
Unix.unlink tlf;
let uncompress_tlog tlx =
let t =
let extension = Tlc2.extension_of tlx in
if extension = Tlc2.archive_extension then
begin
let tlu = Tlc2.to_tlog_name tlx in
Compression.uncompress_tlog tlx tlu >>= fun () ->
Unix.unlink tlx;
Lwt.return ()
end
else if extension = ".tlc" then
begin
let tlu = Tlc2.to_tlog_name tlx in
Tlc_compression.tlc2tlog tlx tlu >>= fun () ->
Unix.unlink tlx;
Lwt.return ()
end
else Lwt.fail (Failure "unknown file format")
in
Lwt_main.run t;0

let run_some_tests repeat_count filter =
Expand Down
2 changes: 1 addition & 1 deletion src/tlog/tlc2.ml
Expand Up @@ -46,7 +46,7 @@ let to_archive_name fn =
let to_tlog_name fn =
let length = String.length fn in
let extension = String.sub fn (length -4) 4 in
if extension = archive_extension
if extension = archive_extension || extension = ".tlc"
then
let root = String.sub fn 0 (length -4) in
root ^ ".tlog"
Expand Down

0 comments on commit ccc998f

Please sign in to comment.