Code Monkey home page Code Monkey logo

11zip's People

Contributors

artemis-beta avatar assertores avatar blawrence-ont avatar iiseymour avatar markbicknellont avatar matjojo avatar sygmei avatar tim-gromeyer avatar xavierberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

11zip's Issues

ZIP single file

Hi,

There is any method to ZIP a single file? Like you do with folder?

Thanks.

extractZip causing runtime error

Hello,

I'm attempting to extract a zip file using this method:

void UtilityFunctions::unzip_file(const std::string path, const std::string job_num) {
    /*
     * Unzip the zip file located at path.
     * @param path: The path to the zip file
     */

    const std::string target {get_home_path() + "\\Downloads\\tmp"};
    std::cout << "Extracting " << path << " to " << target << std::endl;
    elz::extractZip(path, target);
}

Here's some console output:

Extracting C:\Users\rwardrup\Downloads\5284174 COMSOF Export_.zip to C:\Users\rwardrup\Downloads\tmp
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
  what():  filesystem error: cannot create directory: File exists [C:]

However, my program crashes at the extractZip step. I've verified the zip file, but I can't figure it out. Is this the correct implementation?

Compilation error when linking against 11Zip with CMake

When adding 11Zip to a scikit-build-core CMake project using add_subdirectory, the following error is thrown:

/usr/bin/ld: extlibs/11Zip/libelzip.a(elzip.cpp.o): warning: relocation against `_ZTVSt9basic_iosIcSt11char_traitsIcEE@@GLIBCXX_3.4' in read-only section `.text.unlikely'
/usr/bin/ld: extlibs/11Zip/libelzip.a(elzip.cpp.o): relocation R_X86_64_PC32 against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

In order to fix it, the following command needs to be added to 11Zip CMakeLists.txt:
target_compile_options(elzip PRIVATE -fPIC)

Probably, the reason for this error is that scikit-build-core generates a dynamic library, which is then called by python

CMake Error

Following the installation instructions of

add_subdirectory(
        vendor/elzip
)
target_link_libraries(docproc2 PRIVATE
        elzip
)

results in this outcome:

-- Fetching zlib https://github.com/madler/zlib master
CMake Error at vendor/elzip/extlibs/minizip/CMakeLists.txt:197 (add_subdirectory):
  The binary directory

    /home/kharrison/source/docproc-v2/cmake-build-debug/_deps/zlib-build

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/kharrison/source/docproc-v2/cmake-build-debug/_deps/zlib-src

  Specify a unique binary directory name.

I understand this is more to do with minizip at that point, but what does one advise to do when encountering this situation while installing this library?

Installation Fail on VS2019 16.6.5 via cmake 3.17.3

@Sygmei Hello! Thanks for sharing the library.
I git cloned to my C disk via git bash. Then these steps are done:

C:\11Zip\minizip> cmake CMakeLists.txt
C:\11Zip>         cmake CMakeLists.txt

image
This one is failing:
image

Well, I have opened minizip.sln in minizip folder. VS opens it and builds it. But as soon as I create main there and try to include #include "../unzipper.cpp" to use its inner functions, VS gives errors. At first, all the includes are becoming broken
image
Source.cpp is just these 5 lines:

#include "../unzipper.cpp"

int main()
{
	return 0;
}

What can I do to proceed with the installation?
Thank you!

This library is too awesome

I simply cannot describe how ecstatic I am that this library exists. I had a simple requirement: I needed to unzip a file downloaded from a server in my app. I searched for MONTHS. Yes, Months. Zlib? After finally getting it to compile I realise it's meant for streams and not archives. Minizip? None of the repositories I found worked, even after going through their code and making changes to my build system they just simply wouldn't link properly (I tried my best :( I'm a mediocre programmer)

This was extremely frustrating as this unzipping thing was just a minor yet necessary part of my app, and I had a lot more and bigger things to worry about. Having to write my own zipping library uisng zlib was just out of the question for me.

So you can imagine my elation when I discovered this, changed literally 3 things on my end, and it worked perfectly. Also I now understand why you called it 11 for the atomic number of sodium as described in the readme.

@Sygmei , I salute you and you have my deepest respect. From the bottom of whats left of my heart after all that searching, Thank You.

(Sorry I opened this as an issue although it's not actually an issue, I just really needed to show you how helpful this has been)

can't unzip zip files containing binary files

description

zipfile only containing text files and folder structures work fine but if it also contains a binary file minizip-ng fails with error -109

reproduction steps

  1. download this file:
    patch.zip
  2. try unziping it with this library.

library crashes while unzipping Einkaufsliste.exe

expected behaviour

it should unzip the zip file without issues.

ZipFolder is not working

elz::zipFolder(std::string folderName, std::string zipTarget = "");

There is novoid for zipfolder

Handling of empty files

I accidentally stumbled across this issue when downloading a git repository with a .gitkeep file. This file is an empty file added to an empty directory to keep it in the repository. When 11zip tries to extract such a file the following is thrown:

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)

by commenting various parts of the code I was able to narrow this down to the _extractFile method running on the empty file.

I am opening this as an issue because I do not know the best way of handling this such that the solution benefits all. For my own project I can just change:

_extractFile(zipFile, filename, currentFile.string());

to:

try {
    _extractFile(zipFile, filename, currentFile.string());
} catch(std::logic_error&) {
    continue;
}

however this is potentially dangerous as if std::logic_error is thrown for another reason it masks the issue, and if this is thrown for a file the user does want to keep they will have no way of knowing there was a failure for the given file.

Unzip only mode

Hello,
I have a question: Is there a plan for a unzip only mode?

I already have defined MZ_DECOMPRESS_ONLY:

cmake_policy(SET CMP0077 NEW)

set(MZ_LIBCOMP OFF)
set(MZ_PKCRYPT OFF)
set(MZ_WZAES OFF)
set(MZ_OPENSSL OFF)
set(MZ_LIBBSD OFF)
set(MZ_SIGNING OFF)

set(MZ_DECOMPRESS_ONLY ON)

add_subdirectory(11Zip)

Some of these variables like MZ_PKCRYPT and MZ_ZLIBget overriden by 11Zip.

I would like to turn them of since the description ob MZ_ZLIB says it's used for compression but I just need decompression: MZ_ZLIB, Enables ZLIB compression

How to install for use in VS project?

I have a VS C++ project that auto updates my project by downloading the latest zip file from URL. I would like to extract it to a directory I have already created on the users machine.

How do I install and use this within my project? I am a bit confused and don't want to mess anything up

LNK2019 in elzip.lib (from unzipper.obj) - link to an unallowed ext symbol

I wonder if the repo is still alive in any way, but can you help me with the thing? Compiler drops the following, I've built the library successfully, there were no errors and it doesn't seem to be my fault in any way:

elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzOpen64 referenced in function "public: bool __cdecl ziputils::unzipper::open(char const *)" (?open@unzipper@ziputils@@QEAA_NPEBD@Z).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzClose referenced in function "public: void __cdecl ziputils::unzipper::close(void)" (?close@unzipper@ziputils@@QEAAXXZ).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzGetGlobalInfo64 referenced in function "private: void __cdecl ziputils::unzipper::readEntries(void)" (?readEntries@unzipper@ziputils@@AEAAXXZ).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzGoToNextFile referenced in function "private: void __cdecl ziputils::unzipper::readEntries(void)" (?readEntries@unzipper@ziputils@@AEAAXXZ).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzLocateFile referenced in function "public: bool __cdecl ziputils::unzipper::openEntry(char const *)" (?openEntry@unzipper@ziputils@@QEAA_NPEBD@Z).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzGetCurrentFileInfo64 referenced in function "public: unsigned int __cdecl ziputils::unzipper::getEntrySize(void)" (?getEntrySize@unzipper@ziputils@@QEAAIXZ).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzOpenCurrentFile referenced in function "public: bool __cdecl ziputils::unzipper::openEntry(char const *)" (?openEntry@unzipper@ziputils@@QEAA_NPEBD@Z).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzCloseCurrentFile referenced in function "public: void __cdecl ziputils::unzipper::closeEntry(void)" (?closeEntry@unzipper@ziputils@@QEAAXXZ).
elzip.lib(unzipper.obj) : error LNK2019: unresolved external symbol unzReadCurrentFile referenced in function "public: class ziputils::unzipper & __cdecl ziputils::unzipper::operator>>(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??5unzipper@ziputils@@QEAAAEAV01@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z).
\prog.exe : fatal error LNK1120: unresolved external elements: 9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.