diff options
author | Brad King <brad.king@kitware.com> | 2013-11-01 20:52:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-01 20:52:18 (GMT) |
commit | 0d8552c4597793262f4201dee98c73907c31d5bc (patch) | |
tree | faa23bf6cd27aceedea7a3edb9dccfb5a4674358 | |
parent | 37b6c1dcb3d31823450798d201ce824f244249d3 (diff) | |
download | CMake-0d8552c4597793262f4201dee98c73907c31d5bc.zip CMake-0d8552c4597793262f4201dee98c73907c31d5bc.tar.gz CMake-0d8552c4597793262f4201dee98c73907c31d5bc.tar.bz2 |
cmSystemTools: Re-order extract_tar logic
Simplify extraction message logic to be easier to follow and to write a
newline before any error messages that may be produced. Also flip
handling of the archive_write_header return code to handle success in
the "then" case and failure in the "else" case.
-rw-r--r-- | Source/cmSystemTools.cxx | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 8320ecf..34a1216 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1619,18 +1619,23 @@ bool extract_tar(const char* outFileName, bool verbose, archive_error_string(a)); break; } - if (verbose && extract) + if(verbose) { - cmSystemTools::Stdout("x "); - cmSystemTools::Stdout(archive_entry_pathname(entry)); - } - if(verbose && !extract) - { - list_item_verbose(stdout, entry); + if(extract) + { + cmSystemTools::Stdout("x "); + cmSystemTools::Stdout(archive_entry_pathname(entry)); + } + else + { + list_item_verbose(stdout, entry); + } + cmSystemTools::Stdout("\n"); } else if(!extract) { cmSystemTools::Stdout(archive_entry_pathname(entry)); + cmSystemTools::Stdout("\n"); } if(extract) { @@ -1644,15 +1649,7 @@ bool extract_tar(const char* outFileName, bool verbose, } r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) - { - cmSystemTools::Error("Problem with archive_write_header(): ", - archive_error_string(ext)); - cmSystemTools::Error("Current file: ", - archive_entry_pathname(entry)); - break; - } - else + if (r == ARCHIVE_OK) { copy_data(a, ext); r = archive_write_finish_entry(ext); @@ -1663,10 +1660,14 @@ bool extract_tar(const char* outFileName, bool verbose, break; } } - } - if (verbose || !extract) - { - cmSystemTools::Stdout("\n"); + else + { + cmSystemTools::Error("Problem with archive_write_header(): ", + archive_error_string(ext)); + cmSystemTools::Error("Current file: ", + archive_entry_pathname(entry)); + break; + } } } archive_read_close(a); |