aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/zip_main.cc
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-12-01 14:25:18 +0000
committerGravatar Irina Iancu <elenairina@google.com>2016-12-01 16:38:07 +0000
commit8457f3f31af0160c6f8c583e977462d0af091317 (patch)
treeb6c4ecd5cd164081c6c1d771ffb7643f54451036 /third_party/ijar/zip_main.cc
parent7ecf87189292308ed38bc15660ef142cf0cf9b3c (diff)
Ijar: extract [] to platform_utils
zip_main.cc no longer needs <unistd.h>. This change takes us closer to compiling ijar, thus Bazel, with MSVC. See https://github.com/bazelbuild/bazel/issues/2157 See https://github.com/bazelbuild/bazel/issues/2107 -- MOS_MIGRATED_REVID=140723658
Diffstat (limited to 'third_party/ijar/zip_main.cc')
-rw-r--r--third_party/ijar/zip_main.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/third_party/ijar/zip_main.cc b/third_party/ijar/zip_main.cc
index 2b99c5f487..578d64c354 100644
--- a/third_party/ijar/zip_main.cc
+++ b/third_party/ijar/zip_main.cc
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <memory>
#include <set>
@@ -161,17 +160,16 @@ void basename(const char *path, char *output, size_t output_size) {
// Execute the extraction (or just listing if just v is provided)
int extract(char *zipfile, char* exdir, char **files, bool verbose,
bool extract) {
- char cwd[PATH_MAX];
- if (getcwd(cwd, PATH_MAX) == NULL) {
- fprintf(stderr, "getcwd() failed: %s.\n", strerror(errno));
+ std::string cwd = get_cwd();
+ if (cwd.empty()) {
return -1;
}
char output_root[PATH_MAX];
if (exdir != NULL) {
- concat_path(output_root, PATH_MAX, cwd, exdir);
+ concat_path(output_root, PATH_MAX, cwd.c_str(), exdir);
} else {
- strncpy(output_root, cwd, PATH_MAX);
+ strncpy(output_root, cwd.c_str(), PATH_MAX);
}
UnzipProcessor processor(output_root, files, verbose, extract);