-
Notifications
You must be signed in to change notification settings - Fork 96
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
IS_DIRECTORY cannot deal with delimiter on windows('\\") #35
Comments
Hi @aijyo, In a ZIP file, all the entry paths are separated by a slash (/), even on windows. Hence, this macro should never be used to match "real" directory paths under windows. Maybe a better name would be "ENTRY_PATH_SEPARATOR". And for your remark for a |
For the DIRECTORY_SEPARATOR problem , I normalized the path with the slash (/) (just like the nodejs.path.normalize...,but not the same) before call the libzipp api; Add the addDir, I found a solution that seems not too heavy, I use dirent.h(https://github.com/tronkko/dirent), so I can enum dir file on windows same as linux |
When you use the methods of libzippp, remember that you are giving an entry name, not a directory path. Hence, as an entry name, only slashes (/) are interpreted as separators. The methods are not intended to handle real file paths. Thanks for the link to dirent.h. I'm not sure yet I will include it, but it can be very useful. |
Thanks, and got it ...."you are giving an entry name, not a directory path" |
Just like the title, because windows delimiter is '\', but the macro DIRECTORY_SEPARATOR is defined as '/'
Follow is the code:
#define DIRECTORY_SEPARATOR '/'
#define IS_DIRECTORY(str) ((str).length()>0 && (str)[(str).length()-1]==DIRECTORY_SEPARATOR)
#define DEFAULT_CHUNK_SIZE 524288
And why not provide a interface just lik addDir that add all the file&directory in a directory to an entry
And more ...
I cannot find a interface that can uncompress a compressed file( like test.zip) to a directory...
The text was updated successfully, but these errors were encountered: