On Mon, 01 Sep 2008, [EMAIL PROTECTED] wrote: Hi Toninho,
> >That's very nice for those wanting to transition. > >(just a small note: the dir change to C:\ looks a bit > >dangerous to me) > Fixed, thanks. > ---cut--- > procedure HB_UnZipFile( cFile, bUpdate, lWithPath, cPassword, ; > cFileToUnzip, bFileUpdate ) > local hUnZip, nErr, cCurDir, cPath > if !( ".zip" $ cFile ) > cFile += ".zip" > endif > hUnZip = HB_UnZipOpen( cFile ) > if !Empty( hUnZip ) > HB_FNameSplit( cFile, @cPath ) This is OK > cCurDir = CurDir() > DirChange( cPath ) This code change current directory. It introduced two problems: 1. it's not MT safe because current directory is global process attribute not thread one so if two threads will execute this code simultaneously then only one will have valid directory. 2. some platforms like WinCE does not support "current directory" idea at all and all paths have to be absolute. The above is also true for any code which tires to use "current drive". It's extremely important that non of core code will change current directory" or "current drive" for MT mode and portability. So these two lines should be removed and path should be given explicitly as 2-nd parameter of HB_UnzipExtractCurrentFile(). > nErr = HB_UnZipFileFirst( hUnZip ) > while nErr == 0 > HB_UnzipExtractCurrentFile( hUnZip, nil, cPassword ) Here it should be changed to: if HB_UnzipFileInfo( hUnzip, @cZipName ) == 0 cZipName := cPath + cZipName HB_UnzipExtractCurrentFile( hUnZip, cZipName, cPassword ) endif If your archive can have absolte paths with drive laters then: cZipName := cPath + cZipName Should be changed and you should remove the drive prefix, f.e.: HB_FNameSplit( cZipName, , , @cDrv ) if !empty( cDrv ) cZipName := SubStr( cZipName, len( cDrv ) + 1 ) endif cZipName := cPath + cZipName > nErr = HB_UnZipFileNext( hUnZip ) > enddo > HB_UnZipClose( hUnZip ) > DirChange( cCurDir ) > endif > return > ---cut--- The above code is not tested but I hope you know the idea. If you will create some set of functions for easier migration from ZIPARCH to HBMZIP library then we can add them to HBMZIP library. But we should try to implement all functionality, f.e. <bUpdate>, <lWithPath>, <cFileToUnzip> and <bFileUpdate> in this function. best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour