Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inArchivePath in addEntry #14

Open
wapmorgan opened this issue Oct 2, 2018 · 8 comments
Open

Add inArchivePath in addEntry #14

wapmorgan opened this issue Oct 2, 2018 · 8 comments
Assignees

Comments

@wapmorgan
Copy link
Contributor

Now addEntry($file, $includeSubFiles = false, $storePath = false) does not support setting name of file in archive. Do you plan to add functionality to specify in-archive path of file when adding it?

@Gemorroj
Copy link
Owner

Gemorroj commented Oct 2, 2018

It seems that 7zip does not have such an opportunity. You can combine addEntry and renameEntry.
This task can be left as an improvement, but not in the near future.

@Gemorroj Gemorroj self-assigned this Oct 13, 2018
@scratcher28
Copy link

+1, could you please provide a 100% working example?

@wapmorgan
Copy link
Contributor Author

@scratcher28, first of all, rename function is available only from 9.30 alpha version of 7zip.

Example is simple (from UnifiedArchive):

$this->sevenZip->addEntry($filename);
$this->sevenZip->renameEntry($filename, $localName);

@mvorisek
Copy link

mvorisek commented Jan 6, 2020

What about using FFI?

@Gemorroj
Copy link
Owner

Gemorroj commented Jan 6, 2020

@mvorisek I tried to use ffi, but because ffi does not support preprocessor directives (see first note https://www.php.net/manual/en/ffi.cdef.php), it is very difficult to load the header file. I've put it off for now.

@mvorisek
Copy link

mvorisek commented Jan 6, 2020

What about preprocessing the header files with https://github.com/metala/ccpp ? It is quite old and not very popular project, but it might be enough and seems to be well written based on the C specs.

Currently the only article on web using FFI is https://stackoverflow.com/questions/18562959/python-cffi-7z-dll-com-access-violations-sometimes and it is for Python. It is also only for extraction. But it seems that only a few C declarations may be required which can even be hardcoded in this project.

@mvorisek
Copy link

@Gemorroj Do you have the experiment code available and do you want to reconsider the ffi solution for this project again?

@Gemorroj
Copy link
Owner

@mvorisek I don't plan any activity with ffi for the foreseeable future.
I deleted my experiments because I thought the technology was still too raw. Either requires a decent knowledge of C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants