|
this definitely sounds like a bug, scott.
i'll look at it tonight or over the weekend.
thanks for finding it
regards
dang!
AbstractSpoon
|
|
|
|
|
Thanks for looking into it...BTW excellent work..
-Scott
=======================================
: W. Scott Dillman
: Principle Software Engineer
: binaryRevelations Interactive, LLC.
: http://www.binaryrevelations.com
=======================================
|
|
|
|
|
unfortunately scott, this is proving more tricky to figure out than i thought it might.
however, i'm onto it so it should get fixed sooner or later (hopefully not too much later).
regards
dang!
AbstractSpoon
|
|
|
|
|
I played with thel ibrary and found some behavior different from WinZip
I zipped a folder where some subfolders contained no files, some had files.
When I unzipped the just created archive, the folders that had no files in them did not get unzipped or even show up in the test application's list control. When I did the same thing with WinZip, directory structure was unzipped the same as it was before zipping, regardless of whether folders were empty or not.
By playing with WinZip and test app, comparing results, I determined then empty folders did not make into the archive at all. Thus I suspect the problem is in Zip operation. I do not know if the problem is in the zlib or the wrappers yet; when I have time, I will trace it.
|
|
|
|
|
yes, i agree that this is very likely a problem in my zip classes.
i guess i did not anticipate such a requirement as zipping empty folders.
i'll look into it.
thanks
dang!
AbstractSpoon
|
|
|
|
|
i've figured out how to fix this and will post an update as soon as i can.
normally there is no need to explicitly add folders as they get added as a by-product of adding a file.
empty folders are of course not handled by this so I've got to add code to explicitly detect and add empty folders.
thanks for finding it.
dang!
AbstractSpoon
|
|
|
|
|
I played with thel ibrary and found some behavior different from WinZip
I zipped a folder where some subfolders contained no files, some had files.
When I unzipped the just created archive, the folders that had no files in them did not get unzipped or even show up in the test application's list control. When I did the same thing with WinZip, directory structure was unzipped the same as it was before zipping, regardless of whether folders were empty or not.
By playing with WinZip and test app, comparing results, I determined then empty folders did not make into the archive at all. Thus I suspect the problem is in Zip operation. I do not know if the problem is in the zlib or the wrappers yet; when I have time I will trace it.
|
|
|
|
|
|
i've finally fixed this and posted an update to CP.
in the meantime you can get the latest code from my website (see link below).
regards
dang!
AbstractSpoon
|
|
|
|
|
Dan! While your project compiles and links with no errors, when i follow your instructions to add your files and zlibstat.lib to my existing project, i get the below error messages and I cant figure out whats wrong.
Can you help? Thanks!
Compiling...
Zipper.cpp
Linking...
Unzipper.obj : error LNK2001: unresolved external symbol _unzOpen
Unzipper.obj : error LNK2001: unresolved external symbol _unzClose
Unzipper.obj : error LNK2001: unresolved external symbol _unzCloseCurrentFile
Unzipper.obj : error LNK2001: unresolved external symbol _unzGetGlobalInfo
Unzipper.obj : error LNK2001: unresolved external symbol _unzGoToFirstFile
Unzipper.obj : error LNK2001: unresolved external symbol _unzGoToNextFile
Unzipper.obj : error LNK2001: unresolved external symbol _unzGetCurrentFileInfo
Unzipper.obj : error LNK2001: unresolved external symbol _unzReadCurrentFile
Unzipper.obj : error LNK2001: unresolved external symbol _unzOpenCurrentFile
Unzipper.obj : error LNK2001: unresolved external symbol _unzLocateFile
Zipper.obj : error LNK2001: unresolved external symbol _zipCloseFileInZip
Zipper.obj : error LNK2001: unresolved external symbol _zipWriteInFileInZip
Zipper.obj : error LNK2001: unresolved external symbol _zipOpenNewFileInZip
Zipper.obj : error LNK2001: unresolved external symbol _zipOpen
Zipper.obj : error LNK2001: unresolved external symbol _zipClose
Debug\WATCHDOG.EXE : fatal error LNK1120: 15 unresolved externals
Error executing link.exe.
|
|
|
|
|
it looks like its not linking to zlibstat.lib correctly.
try adding the zlibstat.lib to the link tab of your project settings and see if that works better.
note: the easiest way to do this is to drop the lib into the project folder so that you don't need to worry about figuring out the correct relative path.
regards
DanG
AbstractSpoon
|
|
|
|
|
|
define ZLIB_WINAPI in project settings/c++/preprocessor definitions, i think.
it cost me a lot of time.
for example:
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
zlib_filefunc_def* pzlib_filefunc_def));
ZEXPORT is defined in the zconf.h
if we use the zlib as dll, we should define ZLIB_DLL, i.e., ZEXPORT is __declspec(dllexport)
if we use the zlib as static link, it seems that we should define ZLIB_WINAPI, i.e.,
ZEXPORT is WINAPI, means stdcall. functions in zlibstat.lib all are stdcall
Zipper.obj : error LNK2001: unresolved external symbol _zipOpen
_zipOpen means _cdecl call
so it was not found in zlibstat.lib.hello to all
|
|
|
|
|
I tried using this and I get an error (-103 invalid zip file) from unzOpenCurrentFile inside the CUnzipper:Unzip method when trying to unzip a Winzip 8.0 compatible file. Winzip unzips it perfectly.
Please help!!! I have this already integrated into my app and don't want to take it out!!
Thanks
|
|
|
|
|
i'm afraid that you will need to direct this to Gilles Vollant (link in Credits section).
regards
DanG
AbstractSpoon
|
|
|
|
|
i mailed gilles and he expressed some surprise that you had a problem.
he asked if you could forward the zip file to him so he could check it out.
is this ok?
regards
DanG
AbstractSpoon
|
|
|
|
|
unfortunately the file is copyrighted so i can't send it. i found an alternative unzip32.dll that i am using. it gets loaded dynamically and is C code so it's not so clean but it works with the same file. i think it is something in the header that the other dll
didn't allow, but the older one does
|
|
|
|
|
i know you've got a solution now but it would be useful for us to be able to figure this out.
can you remove the copyrighted content from the zip file and send it empty or containing anything not covered by copyright.
regards
DanG
AbstractSpoon
|
|
|
|
|
This code might be extremely useful for me, however I need to run it on WinCE. What would be the shortest way to do the porting?
Please advice.
Cheers,
David.
|
|
|
|
|
To start with I would attempt to create a simpler sample project (to grab a file or folder and zip it or unzip it) just to make sure that the underlying wrapper classes and zlib library can be built under WinCE, because this is likely to be where any problems will show up.
then we can discuss any specific issues which need solving.
regards
DanG
AbstractSpoon
|
|
|
|
|
Due to the fact that your messages are from 2003 and there is no furhter conversation about the wince port I think that there is no effort dealing with this topic.
I need a wince port for my project and if there is nothing done at your side I will start the porting tomorrow. When I have finished ( 1 week ) , I can provide the code ...
Regards
Oliver
|
|
|
|
|
Thanks for your work - it's just what I needed. I added some code though, that I needed for zipping the contents of a directory using a relative path, so I thought I would pass it along. Unless I'm missing something, there isn't another way to do this with the existing class.
I added the following new method to CZipper:
bool CZipper::AddFolderToZip(LPCTSTR szFolderPath, LPCTSTR szRelFolderPath)
{
if (!m_uzFile)
return FALSE;
if (szRelFolderPath && strchr(szRelFolderPath, ':'))
return FALSE;
char relFolder[MAX_PATH];
lstrcpy(relFolder, szRelFolderPath);
if(strlen(relFolder) && relFolder[strlen(relFolder)+1] != '\\')
lstrcat(relFolder, "\\");
m_info.nFolderCount++;
char szDrive[_MAX_DRIVE], szFolder[MAX_PATH], szName[_MAX_FNAME];
_splitpath(szFolderPath, szDrive, szFolder, szName, NULL);
lstrcat(szFolder, szName);
char szSearchSpec[MAX_PATH];
_makepath(szSearchSpec, szDrive, szFolder, "*", "*");
WIN32_FIND_DATA finfo;
HANDLE hSearch = FindFirstFile(szSearchSpec, &finfo);
if (hSearch != INVALID_HANDLE_VALUE)
{
do
{
if (finfo.cFileName[0] != '.')
{
char szItem[MAX_PATH];
_makepath(szItem, szDrive, szFolder, finfo.cFileName, NULL);
if (finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
char szSubFolderPath[MAX_PATH];
lstrcpy(szSubFolderPath, relFolder);
lstrcat(szSubFolderPath, finfo.cFileName);
AddFolderToZip(szItem, szSubFolderPath);
}
else
AddFileToZip(szItem, relFolder);
}
}
while (FindNextFile(hSearch, &finfo));
FindClose(hSearch);
}
return TRUE;
}
|
|
|
|
|
I absolutely agree.
I will add the code and repost.
many thanks.
DanG
|
|
|
|
|
in an if() statement:
relFolder[strlen(relFolder)+1] != '\\'
Shouldn't that be "-1" ?
|
|
|
|
|
Thanks for the nice addition.
But here is one problem - it will not work with folders named ".a",".b". am I correct?
Can you please correct and repost?
|
|
|
|