| 87 | namespace elz |
| 88 | { |
| 89 | void extractZip(std::string zipname, std::string target) |
| 90 | { |
| 91 | ziputils::unzipper zipFile; |
| 92 | zipFile.open(zipname.c_str()); |
| 93 | for (std::string filename : zipFile.getFilenames()) |
| 94 | { |
| 95 | std::vector<std::string> splittedPath = split(filename, "/"); |
| 96 | std::string parentPath = join(splittedPath, "/", 0, 1); |
| 97 | std::string cDir(target + ((parentPath == "") ? "" : "/") + parentPath); |
| 98 | std::string cFile(target + "/" + filename); |
| 99 | std::string fillPath; |
| 100 | std::string buffTest = "."; |
| 101 | for (std::string pathPart : split(cDir, "/")) { |
| 102 | |
| 103 | fillPath += ((fillPath != "") ? "/" : "") + pathPart; |
| 104 | if (!isInList(fillPath, listDirInDir(buffTest))) { |
| 105 | createDir(fillPath.c_str()); |
| 106 | } |
| 107 | buffTest = fillPath; |
| 108 | } |
| 109 | std::cout << "fb] Opening file : " << filename << std::endl; |
| 110 | zipFile.openEntry(filename.c_str()); |
| 111 | std::ofstream wFile; |
| 112 | wFile.open(cFile, std::ios_base::binary | std::ios_base::out); |
| 113 | std::string dumped = zipFile.dump(); |
| 114 | wFile.write(dumped.c_str(), dumped.size()); |
| 115 | wFile.close(); |
| 116 | } |
| 117 | } |
| 118 | void extractFile(std::string zipname, std::string filename, std::string target) |
| 119 | { |
| 120 | ziputils::unzipper zipFile; |
nothing calls this directly
no test coverage detected