Skip to content

Commit

Permalink
Merge pull request #2114 from OCamlPro/copy-unknown-archives
Browse files Browse the repository at this point in the history
Simply copy package archives of unknown formats
  • Loading branch information
AltGr committed Apr 16, 2015
2 parents c20723b + c10735d commit 05903f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,15 @@ end
let is_tar_archive = Tar.is_archive

let extract file dst =
let kind, extract_function =
let _, extract_function =
if Zip.is_archive file then "zip", Zip.extract_function
else "tar", Tar.extract_function
in
with_tmp_dir (fun tmp_dir ->
match extract_function file with
| None -> internal_error "%s is not a valid %s archive." file kind
| None ->
mkdir dst;
copy file (dst/Filename.basename file)
| Some f ->
f tmp_dir;
if Sys.file_exists dst then
Expand Down

0 comments on commit 05903f7

Please sign in to comment.